MathsFurther Statistics 1 › Goodness-of-fit tests

Goodness-of-fit tests

Put a model's predicted frequencies beside the observed ones, square the gaps, and one statistic decides whether the difference is more than chance would produce.

Year FMEDEXCEL 9FM0 FS1

Builds on Hypothesis tests for Poisson and geometric models and Representing and interpreting data.

IN THIS TOPIC

  • Compute expected frequencies from a proposed model and form the χ² statistic.
  • Count degrees of freedom, subtracting one for each estimated parameter.
  • Pool classes with expected frequency below 5 and state the conclusion.

WHAT YOU PROBABLY THINK

A large chi-squared statistic proves the model is wrong; a small one proves it is right.

Measuring the gaps

Multiply each class's model probability by the total to get its expected frequency, then accumulate:

χ2 = Σ (Oi - Ei)2Ei

Squaring makes over- and under-shoots count alike; dividing by E keeps a gap of 3 in a class expecting 5 from being drowned by the same gap in a class expecting 500. A large value means the model fits badly, but the test never proves anything either way: it compares the statistic with a critical value and reports evidence, which is what the opening claim overstates in both directions.

Observed against expected for 60 throws: the six gaps give χ² = 4.2, far below the critical 11.07182103144751368expected 10χ² = 4.2 on 5 degrees of freedomcritical value 11.07: no evidence of bias
FIG. 1Observed against expected for 60 throws of a die: the six gaps square and scale into a χ² of 4.2, well inside the 5% critical value 11.07.

WORKED EXAMPLE

Is the die fair?

A die is thrown 60 times, giving 8, 10, 14, 7, 13, 8. Test at the 5% level whether it is fair.

H₀: the die is fair, so each expected frequency is 10.

χ² = (4 + 0 + 16 + 9 + 9 + 4)/10 = 4.2.

Degrees of freedom: 6 classes − 1 = 5, and the 5% critical value is 11.07.

4.2 < 11.07, so do not reject H₀: there is insufficient evidence at the 5% level that the die is unfair.

Counting the degrees of freedom

Start with the number of classes, subtract 1 because the frequencies must total the sample size, and subtract 1 more for every parameter estimated from the data. Fitting a Poisson model with λ taken from the sample mean costs a degree of freedom; fitting one with λ specified in advance does not.

Small expected frequencies distort the statistic, so classes with Ei below 5 are pooled with their neighbours before anything is computed, and the class count used for the degrees of freedom is the pooled one.

Pooling a ragged tail: three classes expecting fewer than 5 merge into one, and the degrees of freedom fall with them18.014.09.04.22.61.4expected < 5: pool them8.26 classes become 4, so the degrees of freedom drop from 5 to 3
FIG. 2Pooling a ragged tail: three classes each expecting fewer than 5 merge into one, and the degrees of freedom fall with them.

YOUR TURN

Degrees of freedom under two regimes

A Poisson model is fitted to data in 7 classes after pooling. Give the degrees of freedom when λ is specified in advance, and when λ is estimated from the sample mean.

Show the working

Specified in advance: 7 − 1 = 6 degrees of freedom.

Estimated from the data: 7 − 1 − 1 = 5.

Estimating a parameter lets the model bend towards the data, so one degree of freedom is surrendered to pay for the flexibility.

THE EXAM BIT

  • Compute expected frequencies to at least one decimal place before squaring anything.
  • Pool classes with expected frequency under 5 first, then count classes for the degrees of freedom.
  • Subtract one degree of freedom for every parameter estimated from the data, and say which.
  • Conclude with evidence language: 'insufficient evidence to reject', never 'the model is correct'.

CHECK YOURSELF

A goodness-of-fit test uses 5 classes after pooling, with the distribution's single parameter estimated from the data. State the degrees of freedom.

Show a hint

Classes minus one, minus one per estimated parameter.

Show the answer

5

1

1

=

3

d

e

g

r

e

e

s

o

f

f

r

e

e

d

o

m

.

χ² sums (O − E)²/E: squared gaps, each weighted down by how large its class was expected to be.

Degrees of freedom are classes minus 1, minus one more for each parameter estimated from the data.

WORKBOOK

Printable practice for this topic: original exam-style questions with room to work, and a fully worked answer book. Free to use; please do not redistribute or sell.

CHECK YOUR PROGRESS

Rate how confident you feel with each objective for this lesson. Ratings are saved in this browser, on this device only.

  • Compute expected frequencies from a proposed model and form the χ² statistic.
  • Count degrees of freedom, subtracting one for each estimated parameter.
  • Pool classes with expected frequency below 5 and state the conclusion.

Open the full revision checklist to see every objective in the course in one place.

No animated video for this topic yet; these notes stand alone.