Chi-squared goodness of fit tests
Studying this course? Keep your progress in one place.
Key facts
- : the model fits. : it does not. The test is always one-tailed.
- ; reject only if it exceeds the critical value.
- Every expected frequency must be at least : combine cells otherwise.
- , with cells after combining and parameters estimated.
The hypotheses
Whether the data could reasonably come from the stated model.
A goodness of fit test asks whether observed data could reasonably have come from a stated model, such as a uniform, binomial, Poisson or Normal distribution.
says the model fits; says it does not. The test is always one-tailed: only a large test statistic is evidence against the model. Write the hypotheses about the whole distribution, not a single parameter.
- The model fits the data
- "The breakdowns follow a Poisson distribution"
- The model does not fit
- About the whole distribution
The hypotheses for a goodness of fit test are about:
The test statistic
Compare each observed frequency with the expected frequency from the model.
For each cell, compare the observed frequency with the expected frequency given by the model. If is true, is approximately distributed. A small value means the data are close to the model.
Under the model , and the expected frequencies must add to the total . Yates' correction is not required.
- Test statistic
- Observed
- Expected
Worked example
A die is thrown 120 times, giving 14, 25, 17, 22, 24, 18. Test whether it is fair at .
- 1
Each face: .
- 2
.
- 3
, critical value .
Observed 12 and expected 10 in a cell. What does that cell add to ?
Expected frequencies
Multiply the total by the model's probability for each cell.
Discrete uniform (fair die): . Continuous uniform on : a class of width has probability . Binomial or Poisson: , estimating or from the sample mean if not given; make the last cell " or more". Normal: standardise class boundaries, with end classes extending to .
Discrete uniform
- for a die
Continuous uniform
- Class probability
Binomial or Poisson
- Estimate p or λ if not given
Normal
- Standardise class boundaries
- End classes go to ±∞
Waiting times are uniform on 0 to 20 minutes. What is the probability for a class of width 5?
Combining cells
If any expected frequency is below , combine it with a neighbour.
The approximation is only reliable if every expected frequency is at least 5. If any , combine it with a neighbouring cell, adding both the expected and the observed frequencies, and repeat until every .
For a Poisson model the small cells are usually in the tail, so combine into " or more". The number of cells in the degrees of freedom is the number after combining.
- Every expected frequencyat least 5
Expected frequencies are 3.45 and 1.17 for two adjacent cells. What next?
Degrees of freedom
: one is lost for the fixed total, and one for each parameter estimated.
, where is the number of cells after combining and is the number of parameters estimated from the data. One degree of freedom is lost because the total of the expected frequencies is fixed.
Write with the actual numbers; method marks are given for showing what and were. These are the degrees of freedom.
- No parameters estimated
- p or λ estimated
- Normal μ and σ² estimated
Poisson fit with estimated from the data, 6 cells after combining. Degrees of freedom?
Carrying out the test
Find expected frequencies, combine, calculate , and compare with the critical value.
Reject if is greater than the critical value; otherwise there is insufficient evidence to reject it. Conclude in context.
For the die: , , , and the critical value is . Since there is no evidence the die is unfair. The same statistic is used for contingency tables.
- 1
State H₀ and H₁
About the model
- 2
Expected frequencies
Combine where E is below 5
- 3
Calculate X²
- 4
Find ν and the critical value
From the tables
- 5
Conclude
In context
When do you reject in a goodness of fit test?
Try an exam question
A four-sector spinner is spun times, giving , , and for the four sectors. Test, at the level, whether the spinner is fair. The critical value of at is .
[5 marks]
- [1]: the spinner is fair (the model fits). : it is not.
- [1]Expected frequency for each sector.
- [1].
- [1], so the critical value is .
- [1], so insufficient evidence to reject : the spinner may be fair.
That's the notes covered.
Carry on to the next subtopic.
Try a question
Find the expected frequency for each face if the die is fair.
1 mark, marked against the mark scheme
Find the expected frequency for each face if the die is fair.
1 mark, marked against the mark scheme