Goodness of fit tests and contingency tablesEdexcel A-Level Further Maths: Revision notes
Section 1
Hypotheses and the test statistic
A goodness of fit test checks whether observed frequencies are consistent with a proposed model. State the hypotheses in words: : the model fits (for example, the die is fair, or the data follow ); : the model does not fit. The test statistic is where are the observed frequencies and the expected frequencies if is true. is approximately distributed. A large value means the data are far from the model, so the test is always one-tailed (upper tail).
Writing hypotheses about the sample ('the data are uniform'). They must be about the model or population.
Section 2
Expected frequencies and combining cells
Find each as total probability. For a discrete uniform model with outcomes, . For a binomial model, using ; for Poisson, using , with the last cell as 'r or more' so the probabilities sum to 1. The approximation is only reliable if every . If a cell has , combine it with a neighbouring cell (adding both and ) and count the combined cell as one. For example, expected frequencies become .
Combining the observed frequencies but leaving the expected frequencies uncombined (or the reverse).
Section 3
Degrees of freedom
The degrees of freedom are . The '' is because the total is fixed. If a parameter is given in the question (a fair die, , ) nothing more is subtracted. If it is estimated from the sample, subtract one for each estimate: for a binomial, for a Poisson. Examples: a die has ; with estimated and 3 cells left has .
Always count the cells after combining, not before.
Section 4
Fitting uniform, binomial and Poisson models
Discrete uniform: : each outcome is equally likely; ; no parameters estimated, so . Binomial : if is not given, estimate it from the sample mean, , then . If is given, . Poisson : if is not given, use ; the final cell 'r or more' has . When a last cell like '4 or more' is used, you need the total of the observations in that cell to find .
Section 5
Contingency tables
A contingency table classifies each observation by two variables. The test asks whether they are independent: : there is no association between the variables (they are independent); : there is an association. Under , and for rows and columns. No parameters are estimated separately (the formula for already allows for the totals). Combine cells with by merging rows or columns, and recalculate from the new table. For a table .
Using for a contingency table. Use .
Section 6
Reaching a conclusion
Compare with the critical value from the table at the given significance level (for example at 5% gives ; gives ; gives ). If critical value, reject . Alternatively, a calculator gives the p-value : reject if it is below the significance level. Worked example: a die rolled 120 times gives for each face, , , critical value . Since , there is no evidence that the die is unfair. Always write the conclusion in context.
A small is not proof the model is right, only that there is no evidence against it.
That's the notes covered.
Carry on to the next subtopic.
Exam questions on Goodness of fit tests and contingency tables
- A six-sided die is rolled 120 times. The frequencies of the faces are respectively. A test is carried out, at the 5% significance level, of whether the die is fair.Calculate the value of the test statistic .2 marks
- A survey of 120 students recorded their gender and usual mode of travel to school. Of the 60 boys, 20 walk, 25 take the bus and 15 come by car. Of the 60 girls, 30 walk, 20 take the bus and 10 come by car. A test is used to investigate whether mode of travel is associated with gender.The test statistic is , to 3 significant figures. State the conclusion of the test at the 5% significance level, giving the critical value used.2 marks
- A farmer packs eggs in boxes of 4. In a random sample of 100 boxes, the numbers of boxes containing cracked eggs were respectively. The farmer suggests that the number of cracked eggs in a box follows a binomial distribution , where is estimated from the data.Show that the estimate of is , and find the expected frequency of boxes containing exactly one cracked egg, to 2 decimal places.3 marks
Written by the Exaim team, led by Shaun Daswani (Head of Upper Secondary, Improve ME Institute; MSc Financial Mathematics, Imperial College London; BSc, UCL) and Jason Daswani (operational lead, Improve ME Institute; LSE).