# Hypothesis tests about the variance

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.

## 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 independent random variables , ..., , all having a normal distribution with:

• known mean ;

• unknown variance .

### The null hypothesis

We test the null hypothesis that the variance is equal to a specific value :

### The test statistic

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

The critical region iswhere and .

Thus, the critical values of the test are and .

### The decision

We reject the null hypothesis if , that is, if or if .

Otherwise the null is not rejected.

### The power function

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 .

Proof

The power function can be written aswhere we have definedAs 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.

### The size of the test

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.

Proof

Substitute with in the power function and note that when .

### How to choose the critical value

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.

## 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 independent random variables , ..., , all having a normal distribution with:

• unknown mean ;

• unknown variance .

### The null hypothesis

We test the null hypothesis that the variance is equal to a specific value :

### The test statistic

We construct a test statistic by using the sample meanand either the unadjusted sample varianceor the adjusted sample variance

The test statistic, known as Chi-square statistic, is

### The critical region

The critical region iswhere and .

Thus, the critical values of the test are and .

### The decision

We reject the null hypothesis if , that is, if or if .

Otherwise the null is not rejected.

### The power function

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.

Proof

The power function can be written aswhere we have definedGiven 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 variablehas a Chi-square distribution with degrees of freedom.

### The size of the test

The size of the test is equal to where the test statistic has a Chi-square distribution with degrees of freedom.

Proof

As before, substitute with in the power function and note that when .

### 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 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.

Solution

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. ButThus,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

### Exercise 2

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 .

Solution

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 solvewhich is equivalent toProvided the right-hand side of the equation is positive, this is solved byIf you wish, you can compute numerically. From the previous exercise we know thatTherefore, we need to computeIn MATLAB, this is done with the command `chi2inv(0.0444,39)`, which gives as a result

### 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 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 isSince and , we have thatIn other words, the test statistic does not exceed the critical values of the test. As a consequence, the null hypothesis is not rejected.