The Chi-squared hypothesis test can be used to test the variance of two samples to see if they are independent or not. This kind of test is also called the Chi-squared goodness of fit test, and we already used it with the mood’s median test.

Another way to use the chi-squared test is for test the variance of a sample with a knowen population variance.

Chi-squared test for indipendence

For run this test for it’s important that:

  • Variable must be nominal or categorical;
  • The variable must be mutually exclusive;
  • You count the frequency of the variable.

In this case the hypothesis are like:

  • H0: The two population have equal variance;
  • H1The two population have different variance.

For run this test you need to:

  • Calculate the total of observation like in the table1
table1 – initial value with sum (contingency table)
  • Calculate the expected frequency that is, for example for Population1/characteristic1 = (200*100)/600, so we have the table2
Characteristic1 Characteristic2 Characteristic3
table2 – expected frequency (expected value table)
  • Now we can compute the statistics in image1:
image1 - chi-squared statistic formula
image1 – chi-squared statistic formula for indipendence


  • O is the observed frequency;
  • E is the expected frequency (we have calculated that in table2)

So in our example we have a chi-squared = (((80 – 33,33)^2)/33,33) + (((120- 66,66)^2)/66,66) + (((100 – 100)^2)/100) + (((20- 66,66)^2)/66,66) + (((80 – 133,33)^2)/133,33) + (((200- 200)^2)/200) = 162,02

The degrees of freedom = (r-1)*(c-1) that is = (2-1)*(3-1) = 2

Now we can look for the chi-squared critical value with 2 degrees of freedom and our alpha. If we work on a two-tailed test we need the critical value for alpha that is 7.378.

Because 162,02 > 7.378 we reject H0.

This test can be also used to test the normality of a sample. To do that you need to know mean and standard deviation of the normal distribution, next you can calculate the expected frequency as the probability to obtatin that value from a normal distribution with that mean and standard deviation.

Chi-squared test of variance

In this test we want to test if the sample is near or not to a specified value of variance.

In this case the hypothesis are like (for the two-tails test):

  • H0: The sample variance is equal to the specified value;
  • H1The sample variance is different from the specified value.

The statistics is calculated with the formula in image2:

 image1 - chi-squared statistic formula for variance from  a specific value
image2 – chi-squared statistic formula for variance from a specific value


  • N is the number of observation;
  • S is the standard deviation of the sample;
  • Sigma0 is the specific standard deviation that we want to test;

The way to conduct the rest of the hypothesis test is like the one-sample t-tests.

Share on: