– statistical procedures whose results are evaluated by reference to the chi-squared distribution.
The setup is as follows:[2][3] A simple example is testing the hypothesis that an ordinary six-sided die is "fair" (i. e., all six outcomes are equally likely to occur).
Pearson's chi-squared test is used to assess three types of comparison: goodness of fit, homogeneity, and independence.
For all three tests, the computational procedure includes the following steps: In this case
A simple application is to test the hypothesis that, in the general population, values would occur in each cell with equal frequency.
The "theoretical frequency" for any cell (under the null hypothesis of a discrete uniform distribution) is thus calculated as and the reduction in the degrees of freedom is
The chi-squared statistic can be also calculated as This result is the consequence of the Binomial theorem.
The result about the numbers of degrees of freedom is valid when the original data are multinomial and hence the estimated parameters are efficient for minimizing the chi-squared statistic.
The chi-squared test indicates a statistically significant association between the level of education completed and routine check-up attendance (chi2(3) = 14.6090, p = 0.002).
This finding may suggest that higher educational attainment is associated with a greater likelihood of engaging in health-promoting behaviors such as routine check-ups.
If there are r rows and c columns in the table, the "theoretical frequency" for a cell, given the hypothesis of independence, is where
The term "frequencies" refers to absolute numbers rather than already normalized values.
Fitting the model of "independence" reduces the number of degrees of freedom by p = r + c − 1.
For the test of independence, also known as the test of homogeneity, a chi-squared probability of less than or equal to 0.05 (or the chi-squared statistic being at or larger than the 0.05 critical point) is commonly interpreted by applied workers as justification for rejecting the null hypothesis that the row variable is independent of the column variable.
The chi-squared test, when used with the standard approximation that a chi-squared distribution is applicable, has the following assumptions:[7] A test that relies on different assumptions is Fisher's exact test; if its assumption of fixed marginal distributions is met it is substantially more accurate in obtaining a significance level, especially with few observations.
In the vast majority of applications this assumption will not be met, and Fisher's exact test will be over conservative and not have correct coverage.
In the special case where there are only two cells in the table, the expected values follow a binomial distribution, where In the above example the hypothesised probability of a male observation is 0.5, with 100 samples.
The Pearson test statistic can be expressed as which can in turn be expressed as By the normal approximation to a binomial this is the squared of one standard normal variate, and hence is distributed as chi-squared with 1 degree of freedom.
[citation needed] Broadly similar arguments as above lead to the desired result, though the details are more involved.
One may apply an orthogonal change of variables to turn the limiting summands in the test statistic into one fewer squares of i.i.d.
For any arbitrary value T: We will use a procedure similar to the approximation in de Moivre–Laplace theorem.
independent normally distributed variables of zero mean and unit variance will be greater than T, namely that
Is the die biased, according to the Pearson's chi-squared test at a significance level of 95% and/or 99%?
The outcomes can be tabulated as follows: We then consult an Upper-tail critical values of chi-square distribution table, the tabular value refers to the sum of the squared variables each divided by the expected outcomes.
In this context, the frequencies of both theoretical and empirical distributions are unnormalised counts, and for a chi-squared test the total sample sizes
If there were 44 men in the sample and 56 women, then If the null hypothesis is true (i.e., men and women are chosen with equal probability), the test statistic will be drawn from a chi-squared distribution with one degree of freedom (because if the male frequency is known, then the female frequency is determined).
This probability is higher than conventional criteria for statistical significance (0.01 or 0.05), so normally we would not reject the null hypothesis that the number of men in the population is the same as the number of women (i.e., we would consider our sample within the range of what we would expect for a 50/50 male/female ratio.)
The approximation to the chi-squared distribution breaks down if expected frequencies are too low.
In this case, a better approximation can be obtained by reducing the absolute value of each difference between observed and expected frequencies by 0.5 before squaring; this is called Yates's correction for continuity.
[14] The above reasons for the above issues become apparent when the higher order terms are investigated.