Chi-Square Test
Testing whether observed counts match expected ones (goodness of fit) or whether two categorical variables are independent.
The chi-square test () tests whether categorical data matches an expected distribution.
The test statistic is:
where are observed counts and are expected counts under .
Under , this follows a distribution with degrees of freedom (for goodness of fit) or for a contingency table with rows and columns.
- The statistic is always non-negative, and exactly 0 only when observed counts match expected counts perfectly
- Larger deviations from expected counts contribute quadratically, so a few large discrepancies can dominate many small ones
- The approximation to the distribution improves as sample size grows — it's asymptotic, not exact
- A significant result only establishes association (for independence tests), never causation
Roll a die 60 times. Under (fair die), expect 10 of each face. Observed: 8, 14, 11, 9, 7, 11.
With 5 df, the critical value at is 11.07. Since , fail to reject — no evidence the die is unfair.
A genetics experiment expects a 9:3:3:1 ratio in a cross (Mendelian genetics). Observed counts: 315, 108, 101, 32 (total 556). Expected: . Compute and use the fact that the critical value with 3 df at is 7.81.
Solution
Expected: 312.75, 104.25, 104.25, 34.75.
Since , we fail to reject — the data fits Mendel's expected 9:3:3:1 ratio.
Related concepts
Needs first
Related