- [Charlie] There are oftentimes cases,
where you're interested in making inferences on the variance
not just the mean of a population.
And in these cases,
we need to use the chi-squared distribution,
in order to make conclusions related to the variance.
I've got an example here that we have visited before.
We've got five chicken burritos, from Chipotle over here,
on the right.
We do not know the true population mean,
nor do we know the true population variance.
We can estimate these parameters.
X bar is a good estimate for the mean.
And the sample variance S squared is a good estimate,
for the population variance.
We want to create a 95% confidence interval,
on sigma squared.
That's the true population variance.
And we're going to base that,
on our limited sample statistics.
You saw previously that we can use X bar,
to estimate a confidence interval on the mean.
Similarly, we're going to use the sample variance,
to estimate a confidence interval on sigma squared.
In order to do this,
we're going to use the K squared distribution.
So, yet another new distribution for you.
The point estimator for sigma squared, is S squared.
The sample variance.
In order to develop a confidence interval,
on the true population variance, sigma squared.
We need to relate sigma squared to S squared,
via a distribution.
And this distribution is the chi-squared distribution.
To do this, we define the chi-square statistic,
in terms of the ratio of the sample variance,
to the population variance.
And bear with me, because in our example,
we don't know a population variance.
But this will all kind of wrap together,
later on in this screencast.
So we can create a chi-square statistic,
by taking n-1.
Quantity multiplied by the sample variants,
divided by the population variance.
This statistic has a distribution,
with the following density.
It's not that important that you understand,
what's going on here.
But it's essentially a probability distribution function,
that uses the gamma distribution here in the denominator.
This will likely be the last time you see this.
Because typically we use tables or Excel functions,
to determine things related to the chi-squared distribution.
The chi-squared distribution has mean, k.
K is the degrees of freedom.
That's just your sample size minus one.
And the variance is equal to 2k.
Very importantly, the chi-square distribution is asymmetric.
It is not symmetric like the standard normal,
the normal, or the T distributions.
There's different chi-square distributions,
depending upon the degrees of freedom.
Here, we have ten samples.
So, our degrees of freedom or K.
Or, you'll see this represented as nu.
Greek letter nu, is equal to 9.
So with nine degrees of freedom,
this is what the distribution of chi-squared,
would look like.
Chi-squared is always positive.
It's asymmetric.
And we can determine things related to probabilities,
using these chi-squared distributions.
With 9 degrees of freedom,
what is the chi-squared value that has 5%,
of the distribution above it?
So, what we're trying to find in this example.
Is, what value.
Of, chi-squared.
Has 5% of the distribution above it?
And so we usually put a subscript, 0.05,
meaning that's the chi-squared value, that has 5% above it.
In order to do this,
we can use the tables in the back of your book.
In appendix A, we have 9 degrees of freedom.
So that's new in this table.
We want to determine 5%, to the right.
So we're going to look up 0.05,
and 9 degrees of freedom.
And we see that,
(pause) that's 16.92.
Oftentimes we can write this,
with a second argument in the subscript.
And that is the degrees of freedom.
So chi-squared 0.05, comma, 9.
We can also do this in Excel.
Using the chi-squared.
Dot.
INV.
Dot.
RT.
For right tail.
We put in our alpha, and our n-1.
That's our degrees of freedom.
And Excel gives us a value of, 16.92.
We can also determine what is the chi-squared value,
that has 5% of the distribution below it.
We can write this, as.
Chi-squared, sub.
0.95.
Comma.
9.
That means we have 95% of it, to the right.
Remember, subscript always represents to the right,
with 9 degrees of freedom.
We can look up these tables.
We have 95% to the right,
with 9 degrees of freedom,
and so we get 3.33.
Again, we can use Excel.
In this case,
it's easiest to use the chi-square dot INV function.
And with this function, the alpha is to the left of it.
You could also use chi-square dot INV dot RT,
but instead of alpha of 0.05,
you would have to use alpha of 0.95.
So there's minor variations between these Excel formulas,
that you have to be aware of.
So just kind of a review.
We have our population outlined, by this blue line.
We take a sample to estimate the population parameters.
If we were to take many samples of size 10,
calculate the average, and then plot that.
That would be known as a sampling distribution.
So we have a distribution of x_bar.
We can convert this to a standard normal distribution,
using Z values.
We are standardizing x_bar.
Similarly, if we were to take repeated samples,
of size N equals 10.
Calculate the sample variance.
And similar to how we standardize x_bar,
to convert it to a standardized Z value.
We have standardized S squared, into a chi-squared variable.
This totally depends upon sample size,
where we have n-1, degrees of freedom.
Let's go through another example here.
This is actually a rare example.
The chi-square distribution is typically used,
to create confidence intervals,
and for hypothesis testing.
We collect a sample of the weight of five Chipotle burritos.
If, we knew the population variance.
And, we know that that's equal to 1500.
What is the probability,
that the sample variance of five burritos,
would be greater than 2,500?
We can convert that 2,500.
Again, we're basically standardizing our sample variance.
We multiply by the degrees of freedom,
which is five minus one, or four,
and we divide by our assumed population variance.
That means our chi-squared statistic.
Our chi-squared value is 6.67.
And we're trying to calculate the probability,
that we're greater than that.
So, if this is our chi-squared distribution.
We're calculating a chi-squared statistic of,
6.67,
based upon 4 degrees of freedom.
We can look that up, or we can use Excel, to determine this.
And when we do this.
The probability that our sample variance,
is greater than 2,500,
given that we have 4 degrees of freedom.
We converted this, to a chi-squared variable.
So that's the same as the probability,
that our chi-squared variable's greater than 6.67,
given 4 degrees of freedom.
And when we do that in Excel.
In this case, I use the chi-square dot DIS dot RT function.
We plug in our 6.67,
with 4 degrees of freedom.
And we get,
0.154.
Note that this problem is a little more difficult to do,
using the tables in the back of your book.
If you wanted to use the tables,
it's not arranged in a fashion,
that you can easily use in this case.
Remember, we got a chi-squared variable of 6.67.
We had 4 degrees of freedom.
So essentially 6.67, lies somewhere,
in here.
Which means the probability to the right of it,
is between 0.5 and 0.1,
and that's not that accurate.
Let's talk real quick about creating confidence intervals,
on the true population variance.
We're going to base this on the chi-square distribution.
Here I have an example of, 9 degrees of freedom.
Or, n = 10.
What we're trying to do,
is calculate upper and lower limits.
L.
And U.
Such that the probability that our chi-squared variables,
between those two,
is 1 minus alpha.
Typical values of alpha would be 2, 5, and 10%.
So we take our alpha, we split it into two.
And our job now is to calculate L and U,
or our confidence interval limits.
L is given by chi-squared, one minus alpha over 2,
with n-1, degrees of freedom.
The upper limit is the chi-squared variable,
with alpha over two, to the right of it.
And n-1, degrees of freedom.
We can substitute L and U, into this probability expression,
where alpha is split evenly.
If we make some substitutions,
for our chi-squared variable,
we get the following.
What we're trying to do is,
we're trying to calculate an explicit interval,
for sigma squared.
And so if we rearrange, you can end up with the following.
So this is our confidence interval,
on the true population variance.
Given, our sample statistics.
Let's circle back and solve this problem,
that was initially posed at the beginning of the screencast.
What is a 95% confidence interval on sigma squared?
Well, we can use our expression,
for our confidence interval on the variance.
We can look up these chi-squared values,
also known as percentage points.
You can either use Excel, to get those.
Or you can use the chi-squared table,
in the back of your book.
N-1, is 4.
Our sample variance is 1336.7.
We can divide by 11.14, for our lower limit.
0.48 for our upper limit.
And we end up with, a 95% confidence interval.
And the true population variance,
is 480,
to 11,140.
Now you notice that's a pretty big range.
We have a limited sample size of only 5,
which means we have 4 degrees of freedom.
And that's why we have such a big interval, there.
If you wanted to get a much smaller confidence interval,
you would have to increase your sample size.
So hopefully this screencast gives you a better idea,
on how we can use the chi-squared distribution,
to make inferences on the variance.
And create confidence intervals, on the variance.
Thanks for watching.