Chi-Squared Tests

A-Level Further Maths · Further Statistics

Chi-Squared Tests

Chi-squared (χ²) tests are hypothesis tests for categorical data. They compare observed frequencies with expected frequencies to determine whether there is a statistically significant difference. The two main types are the goodness-of-fit test and the test for independence/association.

The Chi-Squared Statistic

χ² = Σ (O − E)²/E

where:

  • O = observed frequency in each category
  • E = expected frequency in each category
  • The sum is over all categories

A large χ² value suggests the observed data does not fit the expected pattern.

Goodness-of-Fit Test

Tests whether observed data follows a specified distribution (uniform, binomial, Poisson, normal, etc.).

Hypotheses:

  • H₀: The data follows the specified distribution
  • H₁: The data does not follow the specified distribution

Method:

1. Calculate expected frequencies from the proposed distribution

2. Combine categories where E < 5 (merge adjacent cells until all E ≥ 5)

3. Compute χ² = Σ(O − E)²/E

4. Determine degrees of freedom: ν = (number of cells after merging) − 1 − (number of estimated parameters)

5. Compare with χ²_ν critical value at the chosen significance level

6. Reject H₀ if χ² > critical value

Degrees of freedom adjustments:

SituationParameters estimatedν reduction
Distribution fully specified0ν = k − 1
Mean estimated from data1ν = k − 2
Mean and variance estimated2ν = k − 3
Probability p estimated1ν = k − 2

Worked Example: Goodness of Fit

A die is rolled 120 times. Results:

Face123456
O251715232416

H₀: The die is fair (uniform distribution). H₁: The die is not fair.

Expected frequency for each face: E = 120/6 = 20 (all ≥ 5, no merging needed).

χ² = (25−20)²/20 + (17−20)²/20 + (15−20)²/20 + (23−20)²/20 + (24−20)²/20 + (16−20)²/20

= 25/20 + 9/20 + 25/20 + 9/20 + 16/20 + 16/20 = 100/20 = 5.0

ν = 6 − 1 = 5. At 5% significance, χ²₅ = 11.07.

Since 5.0 < 11.07, do not reject H₀. Insufficient evidence that the die is unfair.

Test for Independence (Contingency Tables)

Tests whether two categorical variables are independent (unrelated) or associated.

Hypotheses:

  • H₀: The two variables are independent
  • H₁: The two variables are not independent (there is an association)

Expected frequency for each cell:

E = (row total × column total) / grand total

Degrees of freedom: ν = (r − 1)(c − 1)

where r = number of rows, c = number of columns.

Worked Example: Contingency Table

Survey of 200 students:

Prefer MathsPrefer SciencePrefer EnglishRow total
Male40302090
Female254540110
Col total657560200

H₀: Subject preference is independent of gender.

Expected frequencies (E = row total × col total / 200):

MathsScienceEnglish
Male90×65/200 = 29.2590×75/200 = 33.7590×60/200 = 27
Female110×65/200 = 35.75110×75/200 = 41.25110×60/200 = 33

χ² = (40−29.25)²/29.25 + (30−33.75)²/33.75 + (20−27)²/27 + (25−35.75)²/35.75 + (45−41.25)²/41.25 + (40−33)²/33

= 3.949 + 0.417 + 1.815 + 3.231 + 0.341 + 1.485 = 11.24

ν = (2−1)(3−1) = 2. At 5% significance, χ²₂ = 5.991.

Since 11.24 > 5.991, reject H₀. There is significant evidence of an association between gender and subject preference.

Yates' Correction

For 2×2 contingency tables (ν = 1), apply Yates' continuity correction:

χ² = Σ (|O − E| − 0.5)²/E

This reduces the χ² value slightly, giving a more conservative test. Only use for 2×2 tables.

Conditions and Limitations

  • All expected frequencies should be at least 5. If not, combine adjacent categories
  • Data must be frequencies (counts), not proportions or percentages
  • Observations must be independent (each item in one category only)
  • The test is one-tailed — we only reject for large χ² (right tail)
  • A significant result tells you there IS an association, but not the nature or direction — examine the individual (O−E)²/E contributions to see where the biggest differences are

Reading Chi-Squared Tables

The χ² distribution has one parameter: degrees of freedom ν. Critical values increase with ν.

Common critical values (5% significance):

ν123456810
χ²3.8415.9917.8159.48811.0712.5915.5118.31

Exam Tips

  • Never skip combining cells with E < 5 — state that you are combining and show the new merged cells
  • Always state H₀ and H₁ in context ("The die is fair", not just "the data fits")
  • Show the calculation of each (O−E)²/E term, not just the total
  • Remember: goodness of fit uses ν = k − 1 − (parameters estimated); contingency uses ν = (r−1)(c−1)
  • The test is always compared to the upper tail of the χ² distribution
  • In the conclusion, say "sufficient/insufficient evidence to reject H₀" — never "accept H₀"
  • For contingency tables, the E formula is always (row total × column total) / grand total
Don't understand a part?

Sign in and ask our AI tutor to explain any passage in plain English.

Try AI explanations →

More on Further Statistics

Continuous Distributions: Uniform and Exponential

← All A-Level Further Maths notes