StatlectThe Digital Textbook
Index > Fundamentals of statistics > Hypothesis testing

Hypothesis tests about the variance

This lecture presents some examples of Hypothesis testing, focusing on tests of hypothesis about the variance, that is, on using a sample to perform tests of hypothesis about the variance of an unknown distribution.

Normal IID samples - Known mean

In this example we make the same assumptions we made in the example of set estimation of the variance entitled Normal IID samples - Known mean. The reader is strongly advised to read that example before reading this one.

The sample

The sample $xi _{n}$ is made of n independent draws from a normal distribution having known mean mu and unknown variance sigma^2. Specifically, we observe n realizations $x_{1}$, ..., $x_{n}$ of n independent random variables X_1, ..., X_n, all having a normal distribution with known mean mu and unknown variance sigma^2. The sample is the n-dimensional vector [eq1], which is a realization of the random vector [eq2].

The null hypothesis

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

The alternative hypothesis

We assume that the parameter space is the set of strictly positive real numbers, i.e., [eq4]. Therefore, the alternative hypothesis is[eq5]

The test statistic

To construct a test statistic, we use the following point estimator of the variance:[eq6]

The test statistic is[eq7]This test statistic is often called Chi-square statistic (also written as [eq8]-statistic) and a test of hypothesis based on this statistic is called Chi-square test (also written as [eq9]-test).

The critical region

Let [eq10] and $z_{1}<z_{2}$. We reject the null hypothesis $H_{0}$ if [eq11] or if [eq12]. In other words, the critical region is[eq13]Thus, the critical values of the test are $z_{1}$ and $z_{2}$.

The power function

The power function of the test is[eq14]where $kappa _{n}$ is a Chi-square random variable with n degrees of freedom and the notation [eq15] is used to indicate the fact that the probability of rejecting the null hypothesis is computed under the hypothesis that the true variance is equal to sigma^2.

Proof

The power function can be written as[eq16]where we have defined[eq17]As demonstrated in the lecture entitled Point estimation of the variance, the estimator [eq18] has a Gamma distribution with parameters n and sigma^2, given the assumptions on the sample $xi _{n}$ we made above. Multiplying a Gamma random variable with parameters n and sigma^2 by $n/sigma ^{2}$ one obtains a Chi-square random variable with n degrees of freedom. Therefore, the variable $kappa _{n}$ has a Chi-square distribution with n degrees of freedom.

The size of the test

When evaluated at the point [eq19], the power function is equal to the probability of committing a Type I error, i.e., the probability of rejecting the null hypothesis when the null hypothesis is true. This probability is called the size of the test and it is equal to [eq20]where $kappa _{n}$ is a Chi-square random variable with n degrees of freedom (this is trivially obtained by substituting sigma^2 with $sigma _{0}^{2}$ in the formula for the power function found above).

Normal IID samples - Unknown mean

This example is similar to the previous one. The only difference is that we now relax the assumption that the mean of the distribution is known.

The sample

In this example, the sample $xi _{n}$ is made of n independent draws from a normal distribution having unknown mean mu and unknown variance sigma^2. Specifically, we observe n realizations $x_{1}$, ..., $x_{n}$ of n independent random variables X_1, ..., X_n, all having a normal distribution with unknown mean mu and unknown variance sigma^2. The sample is the n-dimensional vector [eq21], which is a realization of the random vector [eq2].

The null hypothesis

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

The alternative hypothesis

We assume that the parameter space is the set of strictly positive real numbers, i.e., [eq4]. Therefore, the alternative hypothesis is[eq5]

The test statistic

We construct a test statistic by using the sample mean[eq26]and either the unadjusted sample variance[eq27]or the adjusted sample variance[eq28]

The test statistic is[eq29]This test statistic is often called Chi-square statistic (also written as [eq8]-statistic) and a test of hypothesis based on this statistic is called Chi-square test (also written as [eq9]-test).

The critical region

Let [eq10] and $z_{1}<z_{2}$. We reject the null hypothesis $H_{0}$ if [eq11] or if [eq12]. In other words, the critical region is[eq13]Thus, the critical values of the test are $z_{1}$ and $z_{2}$.

The power function

The power function of the test is[eq36]where the notation [eq37] is used to indicate the fact that the probability of rejecting the null hypothesis is computed under the hypothesis that the true variance is equal to sigma^2 and $kappa _{n}$ has a Chi-square distribution with $n-1$ degrees of freedom.

Proof

The power function can be written as[eq38]where we have defined[eq39]Given the assumptions on the sample $xi _{n}$ we made above, the unadjusted sample variance $S_{n}^{2}$ has a Gamma distribution with parameters $n-1$ and [eq40] (see Point estimation of the variance), so that the random variable[eq41]has a Chi-square distribution with $n-1$ degrees of freedom.

The size of the test

The size of the test is equal to [eq20]where $kappa _{n}$ has a Chi-square distribution with $n-1$ degrees of freedom (this is trivially obtained by substituting sigma^2 with $sigma _{0}^{2}$ in the formula for the power function found above).

Solved exercises

Below you can find some exercises with explained solutions.

Exercise 1

Denote by [eq43] the distribution function of a Chi-square random variable with n degrees of freedom. Suppose you observe $40$ independent realizations of a normal random variable. What is the probability, expressed in terms of [eq44], that you will commit a Type I error if you run a Chi-square test of the null hypothesis that the variance is equal to 1, based on the $40$ observed realizations, and choosing $z_{1}=15 $ and $z_{2}=65$ as the critical values?

Solution

The probability of committing a Type I error is equal to the size of the test:[eq45]where $kappa _{40}$ has a Chi-square distribution with $39$ degrees of freedom. But[eq46]Thus,[eq47]If you wish, you can utilize some statistical software to compute the values of the distribution function. For example, with the MATLAB commands chi2cdf(65,39) and chi2cdf(15,39) we obtain[eq48]As a consequence, the size of the test is[eq49]

Exercise 2

Make the same assumptions of the previous exercise and denote by [eq50] the inverse of [eq51]. 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:[eq52]You need to set $z_{1}$ in such a way that [eq53]. In other words, you need to solve[eq54]which is equivalent to[eq55]Provided the right-hand side of the equation is positive, this is solved by[eq56]If you wish, you can compute $z_{1}$ numerically. From the previous exercise we know that[eq57]Therefore, we need to compute[eq58]In MATLAB, this is done with the command chi2inv(0.0444,39), which gives as a result[eq59]

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[eq60]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.

Thus, the value of the test statistic is[eq61]Since $z_{1}=15$ and $z_{2}=65$, we have that[eq62]In other words, the test statistic does not exceed the critical values of the test. As a consequence, the null hypothesis is not rejected.

The book

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