Pearson's chi-square testPearson's chi-square test
) is one of a variety of chi-square tests
procedures whose results are evaluated by reference to the chi-square distribution
. It tests a null hypothesis
that the relative frequencies of occurrence of observed events follow a specified frequency distribution. The events must be mutually exclusive. One of the simplest examples is the hypothesis that an ordinary six-sided die is "fair", i.e., all six outcomes occur equally often.
Chi-square is calculated by finding the difference between each observed and theoretical frequency, squaring them, dividing each by the theoretical frequency, and taking the sum of the results:
- O = an observed frequency
- E = an expected (theoretical) frequency, asserted by the null hypothesis
For example, to test the hypothesis that a random sample of 100 people has been drawn from a population in which men and women are equal in frequency, the observed number of men and women would be compared to the theoretical frequencies of 50 men and 50 women. If there were 45 men in the sample and 55 women:
There is one degree of freedom
in the comparison (since either difference between observed and expected frequencies, once known, dictates the other). Consultation of the chi-square distribution
for 1 degree of freedom shows that the probability
of observing this difference if men and women are equally numerous in the population is greater than 0.3. This probability is higher than conventional criteria for statistical significance
, so normally we would accept the null hypothesis that the number of men in the population is the same as the number of women.
Pearson's chi-square is used to assess two types of comparison: tests of goodness of fit and tests of independence. A test of goodness of fit establishes whether or not an observed frequency distribution differs from a theoretical distribution. A test of independence assesses whether paired observations on two variables are independent of each other – for example, whether people from different regions differ in the frequecy with which they report that they support a political candidate.
Pearson's chi-square is the original and most widely-used chi-square test.
The null distribution of the Pearson statistic is only approximated as a chi-square distribution. This approximation arises as the true distribution, under the null hypothesis, of the expected value is given by a Binomial distribution:
- p = probability, under the null hypothesis
- n = number of samples
In the above example the hypothesised probability of a male observation is 0.5, with 100 samples. Thus we expect to observe 50 males.
When comparing the Pearson test statistic against a chi-squared distribution, the above binomial distribution is approximated as a Gaussian (normal) distribution:
By definition, a sum of standard normal variates, , is distributed as chi-square with degrees of freedom:
In cases whereby the expected value, E, is found to be small (indicated either a small underlying population probability, or a small number of observations), the normal approximation of the binomial distribution can fail, and in such cases it is found to be more appropriate to use a likelihood ratio
-based test statistic.
See also Yates' correction for continuity, median test.