I am reading about chi-square test but came across Chi square test of independence, Chi square test for goodness of fit and Chi square test of variance. I am confused and unable to find out what is the difference between these three.

I have come across theories but needed some examples to get these thing clear.

PS: My understanding is that chi square test of independence = chi square test of association = chi square test of homogeneity. Do correct me if my understanding is wrong.


1 Answer 1


Match Distribution. One variable with several categories. A classic example is rolling a die and testing whether it is 'fair', which means probabilities of each of the six numbers should be the the same.

Example with simulated fair die. The R procedure assumes that the null hypothesis is that probabilities of the categories are equal, if no other probabilities are specified. The P-value exceeds 5%, so there is no evidence at the 5% level that the the die is unfair.


  1   2   3   4   5   6 
 88  81 102  80  73  76 

Test in R:

Counts= c(88. 81, 102, 80, 73, 76)

    Chi-squared test for given probabilities

data:  Counts
X-squared = 6.568, df = 5, p-value = 0.2548

Independence. Two categorical variables. You wonder whether they are independent. Example: You have 200 subjects, who can be classified into two kinds of categories. Perhaps type of job and amount of education. You wonder whether categories are independent.

Homogeneity. You have 200 subjects from each of five cities. Your other categorical variable might be religious preference. You want to know whether apportionment to various affiliations is uniform across cities.

Numerical example with two cities; test in R. Null hypothesis rejected with P-value near 0. (City A is much more diverse with respect to religion than City B.)

Fake data:

Relig Pref:    C   P   J   I   H  Other/None  TOTAL
City A        34  39  33  35  24   35           200
City B        64  59  36  16  14   14           200

Test in R:

a = c(34, 39, 33, 35, 24, 35)
b = c(62, 58, 36, 16, 14, 14)

TAB = rbind(a,b)

        Pearson's Chi-squared test

data:  TAB
X-squared = 30.729, df = 5, p-value = 1.06e-05

Overall, chi-squared tests of independence and homogeneity are essentially the same from a computational point of view. Details of interpretation if the null hypothesis is rejected often differ between tests of independence and homogeneity.

In all three of the above tests for categorical data a test statistic derived from 'observed' and 'expected' counts has approximately a chi-squared distribution with degrees of freedom depending on the number of levels of categorical variables. (Look at a basic statistics text or google pages online for details.)

Test of variance. Entirely different from the above. For continuous ratio data from a normal population, if you want to test whether the population variance has a particular value, you would use this test.

For example: You have 50 observations from a normal population and want to test $H_0: \sigma^2 = \sigma_0^2 = 10$ against $H_a: \sigma^2 \ne 10.$ Based on the fact that the sample variance $S^2$ has $\frac{(n-1)S^2}{\sigma_0^2} \sim \mathsf{Chisq}(\nu = n-1).$

Here is an example of such a test with $n = 50$ observations and $S^2 = 12.7,$ using Minitab statistical software. With 50 normally distributed observations, a sample variance of 12.7 is consistent with a population variance of 10.

Test and CI for One Variance 


Null hypothesis         σ-squared = 10
Alternative hypothesis  σ-squared ≠ 10

The chi-square method is only for the normal distribution.


 N  StDev  Variance
50   3.56      12.7

95% Confidence Intervals

               CI for        CI for
Method          StDev       Variance
Chi-Square  (2.98, 4.44)  (8.9, 19.7)


Method      Statistic  DF  P-Value
Chi-Square      62.23  49    0.194
  • $\begingroup$ So "Match Distribution" is otherwise known as the Goodness of Fit test? $\endgroup$
    – user321627
    Commented Aug 8, 2022 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.