A-Level Further Maths 9231 / Topic 4.3 / AS & A Level
Does the model fit the data?
A hypothesis says how the data ought to fall: equally, in a given ratio, or as a binomial, Poisson, geometric, normal or other distribution. Turn it into expected frequencies, measure the gap with \(\chi^{2} = \sum \dfrac{(O - E)^{2}}{E}\), count the degrees of freedom carefully and compare with the table.
Under \(\text{H}_0\) (the model fits) find each expected frequency \(E = N \times P(\text{class})\). Combine neighbouring classes until every \(E \ge 5\). Then \(\chi^{2} = \displaystyle\sum \frac{(O - E)^{2}}{E} = \sum \frac{O^{2}}{E} - N\), with degrees of freedom \(\nu = k - 1 - m\), where \(k\) is the number of classes AFTER combining and \(m\) is the number of parameters estimated from the data. Reject \(\text{H}_0\) only when \(\chi^{2}\) exceeds the upper critical value: the test is always upper-tailed.
Fig. 1: the chi-squared distribution with 4 degrees of freedom. The shaded upper tail beyond 9.488 has area 0.05: a value of the test statistic there is significant at the 5% level
Section 01
Observed against expected.
A goodness of fit test starts with \(\text{H}_0\): the data come from a stated model, and \(\text{H}_1\): they do not. Under \(\text{H}_0\) each class has an expected frequency \(E = N \times p\). The statistic \(\displaystyle\sum \frac{(O - E)^{2}}{E}\) is 0 for a perfect match and grows as the observed frequencies \(O\) move away from \(E\). If \(\text{H}_0\) is true it approximately follows a \(\chi^{2}\) distribution, provided every \(E\) is at least 5.
Model in \(\text{H}_0\)
Expected frequency of a class
uniform over \(k\) classes
\(E = \dfrac{N}{k}\) in every class
given ratio \(a : b : c\)
\(E = N \times \dfrac{a}{a + b + c}\), and so on
a distribution
\(E = N \times P(\text{class})\) from that distribution
Degrees of freedom: with \(k\) classes the frequencies must add to \(N\), which uses up one, so \(\nu = k - 1\) when nothing is estimated from the data. Critical values come from the \(\chi^{2}\) table; at 5% they are 3.841, 5.991, 7.815, 9.488, 11.07 for \(\nu = 1\) to 5.
Worked example Is the dice fair?
A dice is thrown 120 times. The scores 1 to 6 occur 15, 25, 18, 22, 14 and 26 times. Test at the 5% level whether the dice is fair.
\(\text{H}_0\): the dice is fair (each score has probability \(\frac{1}{6}\)). \(\text{H}_1\): the dice is not fair.
\(\nu = 6 - 1 = 5\); the 5% critical value is 11.07.
\(6.5 < 11.07\), so do not reject \(\text{H}_0\).
Answer: There is insufficient evidence at the 5% level that the dice is not fair
Worked example A given ratio, with the shortcut
Theory predicts that four types of seedling occur in the ratio \(9 : 3 : 3 : 1\). Of 160 seedlings, 98, 24, 27 and 11 are of the four types. Test at the 5% level whether the data are consistent with the theory.
\(\text{H}_0\): the types occur in the ratio \(9 : 3 : 3 : 1\). \(\text{H}_1\): they do not.
\(E = 160 \times \frac{9}{16}, \ldots\) gives 90, 30, 30, 10, all at least 5.
Divide by \(E\), not by \(O\), and never add up \(O - E\) on its own: those differences always total 0. A small \(\chi^{2}\) does not PROVE the model; it only means the data give no evidence against it.
Section 02
Fitting a distribution, counting the freedom.
When \(\text{H}_0\) names a distribution, find the probability of each value, multiply by \(N\), and let the last class be 'or more' so the probabilities add to 1. If a parameter is not given, estimate it from the data (\(\lambda = \bar{x}\) for a Poisson, \(p = \dfrac{\bar{x}}{n}\) for a binomial). Each parameter estimated costs one more degree of freedom.
Combine first: merge a class with \(E < 5\) into its neighbour (add both the \(O\) and the \(E\) values), and count the classes \(k\) after merging.
Degrees of freedom: \(\nu = k - 1 - m\). Poisson with \(\lambda\) estimated: \(m = 1\). Binomial with \(p\) estimated: \(m = 1\). Normal with \(\mu\) and \(\sigma\) both estimated: \(m = 2\). Parameters GIVEN in the question: \(m = 0\).
Worked example Poisson, mean estimated
The number of emails a help desk receives in 200 one-minute intervals is recorded: 0, 1, 2, 3, 4 and 5 emails occur 42, 72, 50, 22, 8 and 6 times (never more than 5). Test at the 5% level whether a Poisson distribution fits.
\(\bar{x} = \dfrac{72 + 100 + 66 + 32 + 30}{200} = 1.5\), so use \(\text{Po}(1.5)\). \(\text{H}_0\): a Poisson distribution fits; \(\text{H}_1\): it does not.
\(k = 5\) classes, \(\lambda\) estimated: \(\nu = 5 - 1 - 1 = 3\), critical value 7.815. \(0.979 < 7.815\): do not reject \(\text{H}_0\).
Answer: Insufficient evidence at the 5% level that the Poisson model does not fit; \(\text{Po}(1.5)\) is a reasonable model
Worked example Binomial, p estimated
Four seeds are planted in each of 100 pots and the number that germinate is counted: 0, 1, 2, 3, 4 germinate in 5, 14, 33, 32, 16 pots. Test at the 5% level whether \(\text{B}(4, p)\) is a suitable model.
\(\nu = 4 - 1 - 1 = 2\), critical value 5.991; \(1.038 < 5.991\): do not reject \(\text{H}_0\).
Answer: Insufficient evidence at the 5% level that \(\text{B}(4, 0.6)\) is unsuitable
Examiner trap
Count \(k\) AFTER combining and subtract one for every parameter you estimated. In the Poisson example the six values became five classes, and estimating \(\lambda\) took another degree of freedom away: \(\nu = 3\), not 5.
Stage 1 · Learn
Check your understanding
Four quick checks. Each correct answer earns XP and records this skill on your profile.
Quick check+10 XP
Two classes have observed frequencies 30 and 20 and expected frequencies 25 and 25. What is \(\chi^{2}\)?
Quick check+10 XP
A Poisson model, with \(\lambda\) estimated from the data mean, leaves 7 classes after combining. How many degrees of freedom?
Quick check+10 XP
The last class of a goodness of fit table has expected frequency 3.2. What should you do?
Quick check+10 XP
When is \(\text{H}_0\) rejected in a \(\chi^{2}\) goodness of fit test?
Section 03
Continuous models and reading the result.
For a continuous model the classes are intervals: \(E = N \times P(a \le X < b)\), found by integrating a given pdf or from normal tables. Once you have \(\chi^{2}\), look at the individual contributions \(\dfrac{(O - E)^{2}}{E}\). When one cell supplies most of a significant total, the model fails mainly in that class, and the conclusion can say so.
Worked example A given pdf, one cell stands out
A model for the time \(X\) hours to repair a machine has pdf \(f(x) = \dfrac{x}{8}\) for \(0 \le x \le 4\). For 80 repairs the times in \([0, 1), [1, 2), [2, 3), [3, 4]\) occur 12, 13, 22 and 33 times. Test at the 5% level whether the model fits, and comment.
\(P(a \le X \le b) = \dfrac{b^{2} - a^{2}}{16}\), giving \(\frac{1}{16}, \frac{3}{16}, \frac{5}{16}, \frac{7}{16}\), so \(E = 5, 15, 25, 35\).
The first class gives 9.8 of the 10.54: far more short repairs (12) than the model expects (5).
Answer: Sufficient evidence at the 5% level that the model does not fit, mainly because there are too many repairs under 1 hour
Worked example Normal with given parameters
It is claimed that heights of adult men in a town are \(\text{N}(170, 8^{2})\) in cm. For 200 men, the numbers below 162, from 162 to 170, from 170 to 178, and above 178 are 24, 70, 78, 28. Test the claim at the 5% level.
The boundaries are \(z = -1, 0, 1\): probabilities 0.1587, 0.3413, 0.3413, 0.1587, so \(E = 31.73, 68.27, 68.27, 31.73\).
\(\mu\) and \(\sigma\) were given, so \(\nu = 4 - 1 = 3\); critical value 7.815. \(3.753 < 7.815\): do not reject \(\text{H}_0\).
Answer: Insufficient evidence at the 5% level against the claim that heights are \(\text{N}(170, 8^{2})\)
Examiner trap
If \(\mu\) and \(\sigma\) had been estimated from the same 200 heights, \(\nu\) would be \(4 - 1 - 2 = 1\). And an extreme cell explains WHY a model fails; it does not let you drop that cell and test again.
Stage 2 · Exam
Exam-style questions
Unlocks once the four checks above are done. Worth more XP, written to AS & A Level Further Mathematics Paper 1 to 4 standard.
Finish the four checks above to unlock the exam questions
Exam style+20 XP
A random variable is modelled by \(\text{Po}(2.5)\). In 80 observations, find the expected frequency of the value 2.
Exam style+20 XP
Data are fitted by \(\text{B}(5, p)\), with \(p\) estimated from the data. The six classes 0 to 5 reduce to 4 after combining. Find the critical value for a test at the 5% level.
Exam style+20 XP
In a goodness of fit test with 3 degrees of freedom, \(\chi^{2} = 8.20\). Which conclusion is correct?
Exam style+20 XP
A geometric model \(\text{Geo}(0.5)\) is fitted to 64 observations with classes 1, 2, 3 and '4 or more'. Find the expected frequency of '4 or more'.
Skill unlocked
Model tested against the data.
This skill is now recorded on your profile. Keep the chain going.