This page explains how to perform hypothesis tests about the variance of a normal distribution, called Chi-square tests.
We analyze two different situations:
when the mean of the distribution is known;
when it is unknown.
Depending on the situation, the Chi-square statistic used in the test has a different distribution.
At the end of the page, we propose some solved exercises.
Table of contents
The assumptions are the same previously made in the lecture on confidence intervals for the variance.
The sample is drawn from a normal distribution.
Specifically, we observe the realizations of
independent random variables
,
...,
,
all having a normal distribution with:
known mean
;
unknown variance
.
We test the null hypothesis that
the variance
is equal to a specific value
:
To construct a test statistic, we
use the estimator of the
variance
The test statistic, called Chi-square statistic,
is
A test of hypothesis based on it is called a Chi-square test.
We prove below that
has a Chi-square distribution with
degrees of freedom.
The critical region
iswhere
and
.
Thus, the critical values of the
test are
and
.
We reject the null hypothesis if
,
that is, if
or if
.
Otherwise the null is not rejected.
The power function of the test
iswhere:
is a Chi-square random variable with
degrees of freedom;
the notation
indicates
that the probability of rejecting the null is computed under the alternative
hypothesis that the variance is equal to
.
The power function can be written
aswhere
we have
defined
As
demonstrated in the lecture on Point
estimation of the variance, the estimator
has a Gamma distribution with parameters
and
,
given the assumptions made above. If we multiply a Gamma random variable with
parameters
and
by
,
the resulting variable
(
in this case) has a Chi-square distribution with
degrees of freedom.
When evaluated at the point
,
the power function is equal to the probability of committing a
Type I error, that is, of rejecting
the null hypothesis when it is true.
This probability, called size of the
test, is equal to
where
the test statistic
has a Chi-square distribution with
degrees of freedom.
Substitute
with
in the power function and note that
when
.
The critical value is chosen so as to achieve a desired size
.
We decide the size
and then we find two critical values
and
that
solve
We explain how to do this in the page on critical values.
We now relax the assumption that the mean of the distribution is known.
We observe the realizations of
independent random variables
,
...,
,
all having a normal distribution with:
unknown mean
;
unknown variance
.
We test the null hypothesis that the variance
is equal to a specific value
:
We construct a test statistic by using the sample
meanand
either the unadjusted
sample
variance
or
the adjusted sample
variance
The test statistic, known as Chi-square statistic,
is
The critical region
iswhere
and
.
Thus, the critical values of the test are
and
.
We reject the null hypothesis if
,
that is, if
or if
.
Otherwise the null is not rejected.
The power function of the test
iswhere:
the notation
indicates
that the probability of rejecting the null is computed under the alternative
hypothesis that the true variance is equal to
;
has a Chi-square distribution with
degrees of freedom.
The power function can be written
aswhere
we have
defined
Given
the assumptions made above, the unadjusted sample variance
has a Gamma distribution with parameters
and
(see Point estimation of the
variance). As a consequence, the random
variable
has
a Chi-square distribution with
degrees of freedom.
The size of the test is equal to
where
the test statistic
has a Chi-square distribution with
degrees of freedom.
As before, substitute
with
in the power function and note that
when
.
See the comments on the choice of the critical value made for the case of known mean.
Below you can find some exercises with explained solutions.
Denote by
the distribution function
of a Chi-square random variable with
degrees of freedom.
Suppose that we observe 40 independent realizations of a normal random variable.
Find the probability, expressed in terms of
,
that we will commit a Type I error
when:
we run a Chi-square test of the null hypothesis that the variance is equal to 1;
we choose
and
as the critical values.
The probability of committing a Type I
error is equal to the size of the
test:where
has a Chi-square distribution with
degrees of freedom.
But
Thus,
If
you wish, you can utilize some statistical software to compute the values of
the distribution function. For example, the MATLAB commands
chi2cdf(65,39)
and
chi2cdf(15,39)
giveAs
a consequence, the size of the test
is
Make the same assumptions of the previous exercise and denote by
the inverse of
.
Change the critical value
in such a way that the size of the test becomes exactly equal to
.
Replace
with
in the formula for the size of the
test:
We
need to set
in such a way that
In other words, we need to
solve
which
is equivalent
to
Provided
the right-hand side of the equation is positive, this is solved
by
If
you wish, you can compute
numerically. From the previous exercise we know
that
Therefore,
we need to
compute
In
MATLAB, this is done with the command
chi2inv(0.0444,39)
, which gives as a
result
Make the same assumptions of Exercise 1 above.
If the unadjusted sample variance is equal to 0.9, is the null hypothesis rejected?
In order to carry out the test, we need
to compute the test
statisticwhere
is the sample size,
is the value of the variance under the null hypothesis, and
is the unadjusted sample variance. The value of the test statistic
is
Since
and
,
we have
that
In
other words, the test statistic does not exceed the critical values of the
test. As a consequence, the null hypothesis is not rejected.
Please cite as:
Taboga, Marco (2021). "Hypothesis tests about the variance", Lectures on probability theory and mathematical statistics. Kindle Direct Publishing. Online appendix. https://www.statlect.com/fundamentals-of-statistics/hypothesis-testing-variance.
Most of the learning materials found on this website are now available in a traditional textbook format.