Search for probability and statistics terms on Statlect
StatLect

Hypothesis tests about the variance

by , PhD

This page explains how to perform hypothesis tests about the variance of a normal distribution, called Chi-square tests.

We analyze two different situations:

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

Normal distribution with known mean

The assumptions are the same previously made in the lecture on confidence intervals for the variance.

The sample

The sample is drawn from a normal distribution.

Specifically, we observe the realizations of n independent random variables X_1, ..., X_n, all having a normal distribution with:

The null hypothesis

We test the null hypothesis that the variance sigma^2 is equal to a specific value $sigma _{0}^{2}>0$:[eq1]

The test statistic

To construct a test statistic, we use the estimator of the variance[eq2]

The test statistic, called Chi-square statistic, is[eq3]

A test of hypothesis based on it is called a Chi-square test.

We prove below that $chi _{n}^{2}$ has a Chi-square distribution with n degrees of freedom.

The critical region

The critical region is[eq4]where [eq5] and $z_{1}<z_{2}$.

Thus, the critical values of the test are $z_{1}$ and $z_{2}$.

The decision

We reject the null hypothesis if $chi _{n}^{2}in C$, that is, if [eq6] or if [eq7].

Otherwise the null is not rejected.

The power function

The power function of the test is[eq8]where:

Proof

The power function can be written as[eq10]where we have defined[eq11]As demonstrated in the lecture on Point estimation of the variance, the estimator [eq12] has a Gamma distribution with parameters n and sigma^2, given the assumptions made above. If we multiply a Gamma random variable with parameters n and sigma^2 by $n/sigma ^{2}$, the resulting variable ($kappa _{n}$ in this case) has a Chi-square distribution with n degrees of freedom.

The size of the test

When evaluated at the point [eq13], 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 [eq14]where the test statistic $chi _{n}^{2}$ has a Chi-square distribution with n degrees of freedom.

Proof

Substitute sigma^2 with $sigma _{0}^{2}$ in the power function and note that [eq15] when [eq16].

How to choose the critical value

The critical value is chosen so as to achieve a desired size $lpha $.

We decide the size $lpha $ and then we find two critical values $z_{1}$ and $z_{2}$ that solve[eq17]

We explain how to do this in the page on critical values.

Normal distribution with unknown mean

We now relax the assumption that the mean of the distribution is known.

The sample

We observe the realizations of n independent random variables X_1, ..., X_n, all having a normal distribution with:

The null hypothesis

We test the null hypothesis that the variance sigma^2 is equal to a specific value $sigma _{0}^{2}>0$:[eq18]

The test statistic

We construct a test statistic by using the sample mean[eq19]and either the unadjusted sample variance[eq20]or the adjusted sample variance[eq21]

The test statistic, known as Chi-square statistic, is[eq22]

The critical region

The critical region is[eq23]where [eq5] and $z_{1}<z_{2}$.

Thus, the critical values of the test are $z_{1}$ and $z_{2}$.

The decision

We reject the null hypothesis if $chi _{n}^{2}in C$, that is, if [eq25] or if [eq7].

Otherwise the null is not rejected.

The power function

The power function of the test is[eq8]where:

Proof

The power function can be written as[eq29]where we have defined[eq30]Given the assumptions made above, the unadjusted sample variance $S_{n}^{2}$ has a Gamma distribution with parameters $n-1$ and [eq31] (see Point estimation of the variance). As a consequence, the random variable[eq32]has a Chi-square distribution with $n-1$ degrees of freedom.

The size of the test

The size of the test is equal to [eq33]where the test statistic $chi _{n}^{2}$ has a Chi-square distribution with $n-1$ degrees of freedom.

Proof

As before, substitute sigma^2 with $sigma _{0}^{2}$ in the power function and note that [eq34] when [eq35].

How to choose the critical value

See the comments on the choice of the critical value made for the case of known mean.

Solved exercises

Below you can find some exercises with explained solutions.

Exercise 1

Denote by [eq36] the distribution function of a Chi-square random variable with n degrees of freedom.

Suppose that we observe 40 independent realizations of a normal random variable.

Find the probability, expressed in terms of [eq36], that we will commit a Type I error when:

Solution

The probability of committing a Type I error is equal to the size of the test:[eq38]where $kappa _{40}$ has a Chi-square distribution with $39$ degrees of freedom. But[eq39]Thus,[eq40]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)give[eq41]As a consequence, the size of the test is[eq42]

Exercise 2

Make the same assumptions of the previous exercise and denote by [eq43] the inverse of [eq36].

Change the critical value $z_{1}$ in such a way that the size of the test becomes exactly equal to $5%$.

Solution

Replace $15$ with $z_{1}$ in the formula for the size of the test:[eq45]We need to set $z_{1}$ in such a way that [eq46] In other words, we need to solve[eq47]which is equivalent to[eq48]Provided the right-hand side of the equation is positive, this is solved by[eq49]If you wish, you can compute $z_{1}$ numerically. From the previous exercise we know that[eq50]Therefore, we need to compute[eq51]In MATLAB, this is done with the command chi2inv(0.0444,39), which gives as a result[eq52]

Exercise 3

Make the same assumptions of Exercise 1 above.

If the unadjusted sample variance is equal to 0.9, is the null hypothesis rejected?

Solution

In order to carry out the test, we need to compute the test statistic[eq53]where n is the sample size, $sigma _{0}^{2}$ is the value of the variance under the null hypothesis, and $S_{n}^{2}$ is the unadjusted sample variance. The value of the test statistic is[eq54]Since $z_{1}=15$ and $z_{2}=65$, we have that[eq55]In other words, the test statistic does not exceed the critical values of the test. As a consequence, the null hypothesis is not rejected.

How to cite

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.

The books

Most of the learning materials found on this website are now available in a traditional textbook format.