The χ²-Statistic
The chi-squared test compares observed frequencies (O) from data with expected frequencies (E) derived from a theoretical model or assumption. The test statistic measures how far the observed data deviate from what is expected.
The χ²-Distribution
The chi-squared distribution with ν degrees of freedom is right-skewed (unlike the symmetric normal). Its shape depends entirely on ν:
Two Types of χ²-Test in Cambridge 9231
| Test Type | H₀ | H₁ | Degrees of Freedom |
|---|---|---|---|
| Goodness of Fit | Data follows the specified distribution | Data does not follow the specified distribution | k − 1 − p (where p = parameters estimated) |
| Contingency Table (Test of Association) |
Row and column variables are independent | Row and column variables are associated | (r−1)(c−1) |
The χ² approximation is only valid when all expected frequencies are at least 5. If any E < 5, you must combine adjacent categories (merge cells) until all E ≥ 5. Never combine observed frequencies — always merge based on the expected values. Combining reduces the number of categories and therefore the degrees of freedom.
Common Critical Values (from MF19)
| ν | χ² at 10% | χ² at 5% | χ² at 2.5% | χ² at 1% |
|---|---|---|---|---|
| 1 | 2.706 | 3.841 | 5.024 | 6.635 |
| 2 | 4.605 | 5.991 | 7.378 | 9.210 |
| 3 | 6.251 | 7.815 | 9.348 | 11.345 |
| 4 | 7.779 | 9.488 | 11.143 | 13.277 |
| 5 | 9.236 | 11.070 | 12.833 | 15.086 |
| 6 | 10.645 | 12.592 | 14.449 | 16.812 |
| 8 | 13.362 | 15.507 | 17.535 | 20.090 |
| 10 | 15.987 | 18.307 | 20.483 | 23.209 |
Goodness of Fit Tests
A goodness-of-fit (GOF) test assesses whether sample data is consistent with a specified theoretical distribution — uniform, Poisson, binomial, normal, or a custom probability model.
H₁: The data do not follow [distribution name].
Be specific — name the distribution and any known parameters.
If parameters are estimated from data (e.g. λ̂ = x̄ for Poisson), count each estimated parameter — it costs one degree of freedom.
Merge both O and E for the combined cell. Record new degrees of freedom after merging.
Compute each term (O−E)²/E and sum. Show the working in a table — Cambridge requires this.
k = number of categories after merging, p = number of parameters estimated from data.
Always −1 for the constraint Σ E = n.
χ² < χ²_α → fail to reject H₀ — data consistent with model.
χ² ≥ χ²_α → reject H₀ — data not consistent with model.
Write conclusion in context.
Common GOF Distributions — Degrees of Freedom Summary
Faults: 0, 1, 2, 3, 4+
Frequency: 72, 88, 28, 8, 4
Test at 5% whether a Poisson distribution is a good fit.
λ̂ = 0.92 (estimated from data — costs 1 d.f.)
E(X=1) = 200×0.92×e⁻⁰·⁹² = 200×0.3666 = 73.32
E(X=2) = 200×0.92²/2×e⁻⁰·⁹² = 200×0.1686 = 33.72
E(X=3) = 200×0.92³/6×e⁻⁰·⁹² = 200×0.0517 = 10.35
E(X≥4) = 200−79.70−73.32−33.72−10.35 = 2.91
Combined: O = 8+4=12, E = 10.35+2.91 = 13.26
(88−73.32)²/73.32 = 2.942
(28−33.72)²/33.72 = 0.971
(12−13.26)²/13.26 = 0.120
χ² = 4.778
ν = 4 − 1 − 1 = 2
4.778 < 5.991 → Fail to reject H₀
Contingency Tables
A contingency table records counts for combinations of two categorical variables. The χ²-test of association tests whether the two variables are independent.
Expected Frequencies — The Key Formula
Example — 2×3 Contingency Table
| Category A | Category B | Category C | Row Total | |
|---|---|---|---|---|
| Group 1 | 30 (E=28.8) |
45 (E=43.2) |
15 (E=18.0) |
90 |
| Group 2 | 18 (E=19.2) |
27 (E=28.8) |
15 (E=12.0) |
60 |
| Column Total | 48 | 72 | 30 | 150 |
E for cell (Group 1, Category A) = 90×48/150 = 28.8. All expected values ≥ 5 ✓ No merging needed.
Yates' Continuity Correction — 2×2 Tables
χ²_Yates = Σ (|O − E| − 0.5)² / E
Cambridge 9231 may or may not require Yates' correction — the question will specify "with" or "without Yates' correction." If not specified for a 2×2 table, apply it. For tables larger than 2×2, never apply it.
| Science | Arts | Total | |
|---|---|---|---|
| Male | 45 | 25 | 70 |
| Female | 30 | 40 | 70 |
| Total | 75 | 65 | 140 |
E(F,Sci) = 70×75/140 = 37.5 E(F,Arts) = 70×65/140 = 32.5
All E ≥ 5 ✓
χ² = 4×(7.0²/37.5) = 4×1.307 = 5.227
Degrees of Freedom
Getting the degrees of freedom correct is one of the most frequently examined points in χ² questions. The formula depends on the test type and what parameters were estimated.
The General Formula
Parameter Counting — What Reduces ν?
| Situation | Parameters estimated (p) | Extra d.f. lost |
|---|---|---|
| Uniform distribution (given probabilities) | 0 | None |
| Poisson with λ given | 0 | None |
| Poisson with λ estimated from x̄ | 1 | −1 |
| Binomial with p given, n known | 0 | None |
| Binomial with p estimated from data | 1 | −1 |
| Normal with μ, σ² given | 0 | None |
| Normal with μ estimated (= x̄) | 1 | −1 |
| Normal with μ and σ² both estimated | 2 | −2 |
When you estimate a parameter from the data (e.g. λ̂ = x̄), you are using the data to fit the model. This forces one additional constraint on the expected frequencies, reducing the number of "free" cells by one. It is the same principle as losing one d.f. when estimating σ² in the t-test.
Decision Flow — Which Test, Which ν?
Uniform/Given
Probabilities all specified. No estimation.
Poisson (λ̂)
λ estimated from sample mean. One parameter.
Binomial (p̂)
p estimated from sample proportion. One parameter.
Normal (x̄, s²)
Both μ and σ² estimated. Two parameters.
r × c table
No free parameter estimation. Marginal totals fixed.
cells
Worked Examples
= 4/20 + 4/20 + 9/20 + 25/20 + 1/20 + 1/20 = 44/20 = 2.2
Use ±∞ for the open-ended tails.
Practice Questions
White: 0, 1, 2, 3, 4 → Frequency: 12, 30, 38, 14, 6
Estimate p, then test at 5% whether a Binomial(4, p) distribution fits the data.
p̂ = 1.72/4 = 0.43
Expected frequencies (n=100, B(4,0.43)):
P(0) = 0.57⁴ = 0.1056 → E=10.56
P(1) = 4×0.43×0.57³ = 0.3154 → E=31.54
P(2) = 6×0.43²×0.57² = 0.3536 → E=35.36
P(3) = 4×0.43³×0.57 = 0.1765 → E=17.65
P(4) = 0.43⁴ = 0.0342 → E=3.42 < 5 → merge with X=3: O=14+6=20, E=17.65+3.42=21.07
χ² = (12−10.56)²/10.56 + (30−31.54)²/31.54 + (38−35.36)²/35.36 + (20−21.07)²/21.07
= 0.197 + 0.075 + 0.197 + 0.054 = 0.523
ν = 4−1−1 = 2. χ²_{0.05,2} = 5.991
0.523 < 5.991 → Fail to reject H₀
| Car | Public Transport | Other | Total | |
|---|---|---|---|---|
| Full-time | 80 | 60 | 20 | 160 |
| Part-time | 30 | 40 | 10 | 80 |
| Total | 110 | 100 | 30 | 240 |
Expected values:
E(FT,Car)=160×110/240=73.33 E(FT,PT)=160×100/240=66.67 E(FT,Other)=160×30/240=20.00
E(PT,Car)=80×110/240=36.67 E(PT,PT)=80×100/240=33.33 E(PT,Other)=80×30/240=10.00
All E ≥ 5 ✓
χ² = (80−73.33)²/73.33 + (60−66.67)²/66.67 + (20−20)²/20 + (30−36.67)²/36.67 + (40−33.33)²/33.33 + (10−10)²/10
= 0.607 + 0.667 + 0 + 1.213 + 1.333 + 0 = 3.820
ν=(2−1)(3−1)=2. χ²_{0.05,2} = 5.991
3.820 < 5.991 → Fail to reject H₀
(a) GOF test for Poisson with λ unknown, 7 categories after merging.
(b) GOF test for Normal with μ, σ² both estimated, 5 categories remaining.
(c) 4×5 contingency table.
(d) GOF test with 4 equally likely categories, no estimation.
(b) k=5, p=2 (μ and σ² estimated): ν = 5−1−2 = 2
(c) r=4, c=5: ν = (4−1)(5−1) = 12
(d) k=4, p=0: ν = 4−1−0 = 3
Calls: 0, 1, 2, 3, 4, 5+
Freq: 20, 52, 56, 35, 12, 5
The mean is 2.03. Test at 5% whether a Poisson distribution with λ = 2 (given, not estimated) is a good fit.
Expected frequencies (×180):
P(0)=e⁻²=0.1353→E=24.35
P(1)=2e⁻²=0.2707→E=48.72
P(2)=2e⁻²=0.2707→E=48.72
P(3)=4/3×e⁻²=0.1804→E=32.47
P(4)=2/3×e⁻²=0.0902→E=16.24
P(≥5)=1−all above→E=180−170.50=9.50
All E≥5 ✓ No merging needed.
χ²=(20−24.35)²/24.35+(52−48.72)²/48.72+(56−48.72)²/48.72+(35−32.47)²/32.47+(12−16.24)²/16.24+(5−9.50)²/9.50
=0.777+0.221+1.088+0.197+1.108+2.132=5.523
ν=6−1−0=5 (λ given, not estimated). χ²_{0.05,5}=11.070
5.523<11.070→Fail to reject H₀
Interactive χ²-Calculator
Enter observed and expected frequencies for a goodness-of-fit test. The tool checks the 5-rule, computes χ², and gives the decision.
Formula Sheet — χ²-Tests
- Always show the expected frequency table — Cambridge awards marks for E values even if the final χ² is wrong. Set up a table with O, E, and (O−E)²/E columns.
- Check all E ≥ 5 explicitly — state "all expected frequencies ≥ 5" or identify which cell needs merging. This check earns a mark.
- Degrees of freedom: State ν explicitly and show how it was calculated (k, p). A common error is forgetting to subtract p when parameters are estimated.
- Yates' correction: Only for 2×2 tables and only when specified. For larger tables, use the standard formula.
- Conclusion language: For GOF — "data are/are not consistent with a [distribution] at the X% level." For contingency — "there is/is not significant evidence of an association between [variable A] and [variable B]." Never use "correlation."
- Normal GOF: Standardise interval boundaries using z = (x−μ̂)/σ̂, use Φ tables to find probabilities, multiply by n. Open-ended intervals use Φ(−∞) = 0 and Φ(+∞) = 1.