The shape of the lesson
By the end of the lesson, learners can
- 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.
- 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.
- 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.
- State \(\text{H}_0\) (the model, with any given parameters) and \(\text{H}_1\) (it does not fit).
- Estimate any parameter not given: \(\lambda = \bar{x}\), \(p = \bar{x}/n\).
- Expected \(E = N \times P(\text{class})\), with an 'or more' last class; combine until every \(E \ge 5\).
- Compute \(\chi^{2} = \sum \dfrac{(O - E)^{2}}{E}\) (or \(\sum \dfrac{O^{2}}{E} - N\)) and \(\nu = k - 1 - m\).
- Conclude in context: 'sufficient (or insufficient) evidence at the 5% level that ...', and name a cell that dominates.
One picture every idea returns to
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.
Forty-five minutes, phase by phase
| Time | Phase | What happens in the room | Grouping |
|---|---|---|---|
| 0 to 5 min | Hook: predict | Open with the question in the title, 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. Put the figure on the board: it is the one picture every idea in the lesson returns to. | Whole class, then pairs |
| 5 to 13 min | Teach and check: 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. Project tab 2 of the lab (Distributions lab, chi-squared) and let a student drive it while the class predicts. Model the worked example Is the dice fair? on the board, one line at a time. Your turn: A spinner with three equal sectors gives 30, 20 and 40 in 90 spins. Find \(\chi^{2}\) for the hypothesis that it is fair. | Whole class, then pairs |
| 13 to 21 min | Teach and check: 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. Model the worked example Poisson, mean estimated on the board, one line at a time. | Pairs |
| 21 to 30 min | Teach and check: 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. Model the worked example A given pdf, one cell stands out on the board, one line at a time. | Frayer Model |
| 30 to 36 min | Check | The four Stage 1 questions from the student lesson, answered on mini whiteboards or by show of fingers. Re-teach the one most get wrong. | Individual, then whole class |
| 36 to 43 min | Plenary | The exam-style questions from Stage 2, one at a time: thirty seconds alone, then a random call. The feedback lines in the key give the examiner's wording. | Individual, random call |
| 43 to 45 min | Exit and homework | Set the worksheet below (6 questions, 28 marks). Learners self-assess against the objectives before they leave. | Individual |
Protect the parts that carry the learning
The sequence carries about fifty minutes of material, so the lab is driven by one student while the class predicts rather than explored freely. Times are a guide.
Protected: the check at 30 minutes. It is the only individual read on whether the key idea landed, and it is not cut.
Cut first if the build overruns: the last check in Continuous models and reading the result, never the check or the plenary.
In a 60 minute block: run worksheet questions 1 to 3 in class as a Rally Coach set and model both the hardest worked example and its check live.
Frayer Model
Pairs fill a four-box grid for the key term: definition, characteristics, examples and non-examples. The non-examples box is where the misconceptions surface, so give it the most time.
The full structure, with its PIES check and a worked example for every subject, is on the cooperative-learning page, one of fifteen structures there.
What to head off, and how
| Trap learners fall into | Teaching move that pre-empts it |
|---|---|
| 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. |
| 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. |
| 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. |
Chi-squared goodness of fit: worksheet
6 questions, 28 marks. Written in the style of the papers; no past paper question is reproduced.
A shop records the number of returned items on each weekday over several weeks: Monday 32, Tuesday 25, Wednesday 18, Thursday 27, Friday 23. Test at the 5% level whether returns are equally likely on each weekday.
A Poisson distribution, with \(\lambda = 1.9\) estimated from the sample mean, is fitted to 60 observations. The expected frequencies for 0, 1, 2, 3, 4 and '5 or more' are 8.97, 17.05, 16.20, 10.26, 4.87 and 2.64.
(a) Explain which classes must be combined. (b) State the degrees of freedom and the 5% critical value. (c) State how (b) would change if \(\lambda = 1.9\) had been given in the hypothesis.
A genetic theory predicts that three flower colours occur in the ratio \(1 : 2 : 1\). In a sample of 200 plants the colours occur 38, 112 and 50 times. Test the theory at the 5% level.
A player claims that the number of attempts \(X\) she needs to hit a target follows \(\text{Geo}\left(\frac{1}{3}\right)\). In 108 trials the first hit came on attempt 1, 2, 3 or later in 30, 22, 20 and 36 trials. Test the claim at the 5% level.
The number of flaws on each of 100 glass sheets is counted: 0, 1, 2, 3, 4 and '5 or more' flaws occur on 8, 22, 30, 20, 12 and 8 sheets.
(a) Test at the 10% level whether the number of flaws follows \(\text{Po}(2)\). (b) State the degrees of freedom you would use if the mean had instead been estimated from these data.
The waiting time \(T\) minutes at a bus stop is modelled by the pdf \(f(t) = \dfrac{2(3 - t)}{9}\) for \(0 \le t \le 3\). For 90 waits, 42 were under 1 minute, 34 were from 1 to 2 minutes and 14 were from 2 to 3 minutes.
(a) Show that the expected frequencies are 50, 30 and 10. (b) Test at the 5% level whether the model fits. (c) Which class contributes most to \(\chi^{2}\), and what does it suggest?
Answer key and marking notes
- \(\text{H}_0\): returns are equally likely on each day; \(\text{H}_1\): they are not. \(N = 125\), so \(E = 25\) each.
- \(\chi^{2} = \dfrac{49 + 0 + 49 + 4 + 4}{25} = \dfrac{106}{25} = 4.24\).
- \(\nu = 5 - 1 = 4\); 5% critical value 9.488.
- \(4.24 < 9.488\): insufficient evidence at the 5% level that returns are not equally likely on each weekday.
- (a) 4.87 and 2.64 are below 5; combining '4' and '5 or more' gives \(E = 7.51\), and every class then has \(E \ge 5\).
- (b) \(k = 5\) classes and one estimated parameter: \(\nu = 5 - 1 - 1 = 3\), critical value 7.815.
- (c) With \(\lambda\) given, nothing is estimated: \(\nu = 5 - 1 = 4\), critical value 9.488.
- \(\text{H}_0\): the colours occur in the ratio \(1 : 2 : 1\); \(\text{H}_1\): they do not. \(E = 50, 100, 50\).
- \(\chi^{2} = \dfrac{144}{50} + \dfrac{144}{100} + 0 = 2.88 + 1.44 = 4.32\).
- \(\nu = 3 - 1 = 2\); 5% critical value 5.991.
- \(4.32 < 5.991\): insufficient evidence at the 5% level that the colours do not follow the ratio \(1 : 2 : 1\).
- \(\text{H}_0\): \(X \sim \text{Geo}\left(\frac{1}{3}\right)\); \(\text{H}_1\): it does not.
- \(P(X = 1) = \frac{1}{3}\), \(P(X = 2) = \frac{2}{9}\), \(P(X = 3) = \frac{4}{27}\), \(P(X \ge 4) = \left(\frac{2}{3}\right)^{3} = \frac{8}{27}\).
- \(E = 36, 24, 16, 32\), all at least 5.
- \(\chi^{2} = \dfrac{36}{36} + \dfrac{4}{24} + \dfrac{16}{16} + \dfrac{16}{32} = 1 + 0.167 + 1 + 0.5 = 2.667\).
- \(\nu = 4 - 1 = 3\), critical value 7.815. \(2.667 < 7.815\): insufficient evidence at the 5% level against the claim.
- (a) \(\text{H}_0\): the number of flaws follows \(\text{Po}(2)\); \(\text{H}_1\): it does not.
- \(E = 100 \, P(X = x)\): 13.53, 27.07, 27.07, 18.04, 9.02 and, for '5 or more', 5.27; all at least 5, so no combining.
- \[\begin{aligned}\chi^{2} &= 2.263 + 0.949 + 0.318 \\ &\quad + 0.212 + 0.983 + 1.420 = 6.144\end{aligned}\]
- \(\nu = 6 - 1 = 5\); 10% critical value 9.236. \(6.144 < 9.236\): insufficient evidence at the 10% level that \(\text{Po}(2)\) is not a suitable model.
- (b) One parameter estimated: \(\nu = 6 - 1 - 1 = 4\).
- (a) \(P(a \le T \le b) = \displaystyle\int_{a}^{b} \frac{2(3 - t)}{9}\,dt\) gives \(\frac{5}{9}, \frac{3}{9}, \frac{1}{9}\); times 90: 50, 30, 10.
- (b) \(\text{H}_0\): the model fits; \(\text{H}_1\): it does not.
- \(\chi^{2} = \dfrac{64}{50} + \dfrac{16}{30} + \dfrac{16}{10} = 1.28 + 0.533 + 1.6 = 3.413\).
- \(\nu = 3 - 1 = 2\), critical value 5.991; \(3.413 < 5.991\): insufficient evidence at the 5% level that the model does not fit.
- (c) The 2 to 3 minute class gives 1.6: there were more long waits (14) than the model expects (10), though not enough to be significant.
8 multiple-choice questions on this lesson
From the topic question bank. Assign them in the app for a marked score in your gradebook, or run the topic as a class game.
A variable is modelled by \(\text{B}(3, 0.4)\). In a goodness of fit test with 250 observations, find the expected frequency of the value 1.
- A\(62.5\)
- B\(108\)
- C\(100\)
- D\(36\)
A test of whether data fit the distribution \(\text{Po}(2)\) (the mean 2 is given, not estimated) starts with 6 classes, which become 5 after combining. Find the critical value for a test at the 5% level.
- A\(9.488\)
- B\(11.07\)
- C\(7.815\)
- D\(0.711\)
A spinner with four equal sectors is spun 80 times. The four sectors come up 14, 26, 18 and 22 times. Find the value of \(\chi^{2}\) for the hypothesis that the spinner is fair.
- A\(0.8\)
- B\(80\)
- C\(16\)
- D\(4.0\)
A goodness of fit test of a fully specified model uses 4 classes and gives \(\chi^{2} = 8.62\). Which is the correct conclusion at the 1% significance level?
- A\(8.62 > 7.815\): reject H0; the model does not fit
- B\(8.62 < 11.34\): insufficient evidence at 1% to reject the model
- C\(8.62 > 0.115\): reject H0; the model does not fit
- D\(8.62 < 11.34\): this proves the model is correct
In 100 intervals a counter records 0, 1, 2, 3, 4 and 5 events in 20, 35, 25, 12, 6 and 2 intervals (never more than 5). A Poisson model is fitted, with its mean estimated from the data. Find the expected frequency of the class '4 or more', to 3 s.f.
- A\(8.00\)
- B\(5.10\)
- C\(2.10\)
- D\(7.21\)
A model for a proportion \(X\) has pdf \(f(x) = 2x\) for \(0 \le x \le 1\). In 60 observations, the intervals \([0, 0.5)\), \([0.5, 0.75)\) and \([0.75, 1]\) contain 21, 19 and 20 values. Find \(\chi^{2}\) for the hypothesis that the model fits, to 3 s.f.
- A\(3.67\)
- B\(75.1\)
- C\(0.100\)
- D\(3.89\)
For 80 families with three children, the numbers of girls 0, 1, 2, 3 occur 8, 28, 30 and 14 times. A model \(\text{B}(3, p)\) is fitted, with \(p\) estimated from the data; every expected frequency is at least 5. State \(\nu\) and the 5% critical value.
- A\(\nu = 2\), critical value \(5.991\)
- B\(\nu = 1\), critical value \(3.841\)
- C\(\nu = 4\), critical value \(9.488\)
- D\(\nu = 3\), critical value \(7.815\)
A test of whether 50 observations fit \(\text{Po}(1.2)\) (mean given) uses classes 0, 1, 2, 3 and '4 or more'. Find the number of classes used after any necessary combining, and \(\nu\).
- A3 classes, \(\nu = 2\)
- B4 classes, \(\nu = 2\)
- C4 classes, \(\nu = 3\)
- D5 classes, \(\nu = 4\)
Quiz key
\(P(X = 1) = \binom{3}{1}(0.4)(0.6)^{2} = 3 \times 0.144 = 0.432\), so \(E = 250 \times 0.432 = 108\). \(36\) leaves out the coefficient \(\binom{3}{1} = 3\). \(62.5\) shares 250 equally between the four values 0 to 3, which is the uniform model, not the binomial. \(100\) uses \(250 \times 0.4\), treating \(p\) as \(P(X = 1)\).
\(k = 5\) classes after combining and \(m = 0\) (the mean was given), so \(\nu = 4\) and the upper 5% point of \(\chi^{2}_{4}\) is 9.488. \(7.815\) (\(\nu = 3\)) subtracts 1 for a mean that was not estimated. \(11.07\) (\(\nu = 5\)) counts the 6 classes before combining. \(0.711\) is the LOWER 5% point of \(\chi^{2}_{4}\); the test is upper-tailed.
Each \(E = 20\). \(\chi^{2} = \dfrac{36 + 36 + 4 + 4}{20} = \dfrac{80}{20} = 4.0\). \(80\) adds the squared differences but forgets to divide by \(E\). \(0.8\) uses \(\dfrac{|O - E|}{E}\) without squaring. \(16\) is the sum of the absolute differences \(|O - E|\).
\(\nu = 4 - 1 = 3\) and the upper 1% point of \(\chi^{2}_{3}\) is 11.34. As \(8.62 < 11.34\), H0 is not rejected: there is insufficient evidence at the 1% level that the model does not fit. \(7.815\) is the 5% critical value, not 1%. Saying the test proves the model is correct is too strong; not rejecting H0 never proves it. \(0.115\) is the lower 1% point; the test is upper-tailed.
\(\lambda = \dfrac{0 + 35 + 50 + 36 + 24 + 10}{100} = 1.55\). \(P(X \le 3) = e^{-1.55}\left(1 + 1.55 + \tfrac{1.55^{2}}{2} + \tfrac{1.55^{3}}{6}\right) = 0.9279\), so \(E = 100(1 - 0.9279) = 7.21\). \(5.10\) is \(100\,P(X = 4)\) only, so the expected frequencies would not add up to 100. \(2.10\) is \(100\,P(X \ge 5)\), one class too far. \(8.00\) is the observed frequency \(6 + 2\), not an expected one.
\(F(x) = x^{2}\), so the probabilities are \(0.25\), \(0.5625 - 0.25 = 0.3125\) and \(1 - 0.5625 = 0.4375\), giving \(E = 15, 18.75, 26.25\). \(\chi^{2} = \tfrac{36}{15} + \tfrac{0.0625}{18.75} + \tfrac{39.0625}{26.25} = 3.89\). \(3.67\) divides by the observed frequencies instead of the expected ones. \(0.100\) takes \(E = 20\) in every interval, ignoring the model. \(75.1\) forgets to divide each squared difference by \(E\).
\(\hat{p} = \dfrac{28 + 60 + 42}{3 \times 80} = 0.542\); the smallest expected frequency is \(80(1 - \hat{p})^{3} = 7.70 \ge 5\), so all 4 classes stay. \(\nu = 4 - 1 - 1 = 2\), with critical value 5.991. \(\nu = 3\) forgets that \(p\) was estimated. \(\nu = 4\) uses the number of classes as \(\nu\). \(\nu = 1\) also subtracts 1 for \(n = 3\), which is fixed by the situation and not estimated.
The expected frequencies are 15.06, 18.07, 10.84, 4.34 and 1.69. Both '3' and '4 or more' are below 5; together they give 6.03, so there are 4 classes: 0, 1, 2, '3 or more'. The mean was given, so \(\nu = 4 - 1 = 3\). \(\nu = 2\) subtracts 1 for a parameter that was not estimated. 5 classes ignores the small expected frequencies. 3 classes combines more than needed, merging '2' (10.84 already at least 5) as well.
What to project
The student lesson embeds these tabs. Open them full screen on the projector; every slider has a drag handle on the stage.
Slides for this lesson
A projectable deck for every pack is on the way. Until then, present the student lesson full screen: its sections, figure and lab tabs follow the same order as the plan above.