IB Maths AI HL Hypothesis Testing (Chi-squared) Paper 1 & 2 ~9 min read

Goodness of Fit Test

A χ2 goodness of fit test checks whether one variable follows a claimed distribution — uniform, a given ratio, binomial, Poisson or normal. You compare observed frequencies against the expected frequencies that distribution predicts. The machinery (GDC gives χ2 and p-value, then compare) is identical to the independence test — the only new skills are building the expected frequencies yourself and getting the degrees of freedom right, which now drop by an extra 1 for every parameter you had to estimate.

📘 What you need to know

Setting up the test

The null hypothesis is always that the variable can be modelled by the named distribution; the alternative is that it cannot. If you’re given the parameters, state the precise distribution.

Hypotheses & degrees of freedom H0: variable fits the distribution  |  H1: it does not
ν = k − 1 − p   (k = classes after combining, p = parameters estimated) χ² test & the formula are in the booklet ✓

🤔 Why does ν drop by 1 for each estimated parameter?

Each parameter you estimate from the sample (a value of p, m, μ or σ) is one more thing the data has been forced to match, so it removes a degree of freedom. Given the parameter → ν = k − 1. Estimate one → k − 2. Estimate both μ and σ for a normal → k − 3.

DistributionParameters estimatedDegrees of freedom
Uniform / given rationoneν = k − 1
Binomial / Poisson (given)noneν = k − 1
Binomial / Poisson (estimated)p or mν = k − 2
Normal (one estimated)μ or σν = k − 2
Normal (both estimated)μ and σν = k − 3

The six steps

The routine adds two jobs compared with the independence test: you build the expected frequencies, and you adjust ν for estimated parameters.

🧭 Recipe — chi-squared goodness of fit test

  1. Hypotheses: H0 fits the distribution, H1 does not — name the real variable; state the precise distribution if given.
  2. Expected frequencies: P(each outcome) × total N. Combine any class with expected ≤ 5.
  3. Degrees of freedom: ν = k − 1 − (parameters estimated).
  4. Enter observed & expected as two lists in the GDC; read off χ2 and the p-value.
  5. Decide: χ² statistic vs critical value (or p-value vs significance level).
  6. Conclude in context: fits (accept) or does not fit (reject), tentatively.
Independence test vs goodness of fit
INDEPENDENCE GOODNESS OF FIT GDC builds expected matrix ν = (m−1)(n−1) YOU build expected list ν = k − 1 − (params estimated) Same from here: GDC gives χ² & p, compare, conclude in context
Both tests share the same decision machinery — only how you get the expected values and ν differs.
Conclusion wording: rejecting H0 means “sufficient evidence the variable does not follow the distribution”. Accepting means “insufficient evidence against it — so it appears to follow the distribution”. Always name the real variable and stay tentative.

Worked examples

WE 1–2 use the car-salesman sales data (uniform). WE 3 uses the video-game bosses data (binomial). WE 4–5 use the marbled-ducks data (normal).

WE 1

Uniform — expected frequencies & ν

A salesman records sales over 6 weeks: 15, 17, 11, 21, 14, 12. A χ² test at the 5% level checks for a uniform distribution. Find the expected frequency per week and the degrees of freedom.

uniform → all expected frequencies equal total = 15+17+11+21+14+12 = 90 expected each week = 90 ÷ 6 = 15. ν = k − 1 (no parameters estimated) = 6 − 1 expected = 15, ν = 5
WE 2

Uniform — decision & conclusion

Entering observed (15, 17, 11, 21, 14, 12) and expected (all 15) into the GDC gives p = 0.493. State the conclusion at the 5% level, with a reason.

compare p with significance level 0.493 > 0.05 accept H₀ p-value > significance level, so insufficient evidence that the number of sales is not uniform — it appears uniformly distributed.
WE 3

Binomial (given p) — expected value & ν

1000 players defeat 0, 1, 2 or 3 bosses (observed 490, 384, 111, 15). Test against B(3, 0.2) at 5%. Find the expected frequency for “1 boss” and the degrees of freedom.

expected = P(X = x) × N, with X ~ B(3, 0.2) P(X = 1) = 0.384 → 1000 × 0.384 = 384 ν = k − 1 (p was given, not estimated) = 4 − 1 expected(1) = 384, ν = 3 expected values 512, 384, 96, 8 are all > 5, so no combining; GDC gives p ≈ 0.0243.
WE 4

Normal — why combine, and ν

300 ducks fall into classes m<450, 450≤m<470, 470≤m<520, 520≤m<570, m≥570 (freq 1, 9, 158, 123, 9). Tested against N(520, 30²). The first class has expected ≈ 2.94. Explain the fix and give ν.

expected ≤ 5 → must combine merge m<450 with 450≤m<470 → one class m<470 (observed 10), giving k = 4 classes. ν = k − 1 (μ and σ both given, not estimated) = 4 − 1 combine, ν = 3
WE 5

Normal — statistic & conclusion

For the ducks (4 combined classes), the GDC gives χ² = 8.16. The critical value at 10% is 6.251. State the conclusion, with a reason.

compare statistic with critical value 8.16 > 6.251 reject H₀ χ² statistic > critical value, so sufficient evidence that the mass of a marbled duck cannot be modelled by N(520, 30²).

💡 Top tips

⚠ Common mistakes

That wraps the Hypothesis Testing using the Chi-squared Distribution unit — you’ve now met the language of testing, the test for independence, and goodness of fit across uniform, binomial, Poisson and normal models. The thread tying it together: build (or read off) expected frequencies, keep every expected value above 5, get ν right, then let the GDC and one comparison decide. Next unit, you’ll carry this same hypothesis-testing logic into tests built on the normal distribution and comparing means.

Need help with Hypothesis Testing?

Get 1-on-1 help from an IB examiner who knows exactly what Paper 1 & 2 are looking for.

Book Free Session →