All revision notes topics

Chi-squared goodness of fit testsEdexcel International A Level Further Maths: Revision notes

Section 1

The idea and the hypotheses

A goodness of fit test asks whether observed data could reasonably have come from a stated model, such as a discrete or continuous uniform, binomial, Poisson or Normal distribution. H0H_0: the model fits the data (for example, 'the number of breakdowns follows a Poisson distribution'). H1H_1: the model does not fit the data. The test is always one-tailed: only a large value of the test statistic counts as evidence against the model. Write the hypotheses about the whole distribution, not about a single parameter.

Key termsgoodness of fitnull hypothesisalternative hypothesis
Common mistake

Writing H0H_0: μ=…\mu=\ldots or H0H_0: p=…p=\ldots. In a goodness of fit test the hypotheses are about the whole distribution.

Section 2

The test statistic

For each cell, compare the observed frequency OiO_i with the expected frequency EiE_i given by the model: X2=∑(Oi−Ei)2Ei.X^2=\sum\frac{(O_i-E_i)^2}{E_i}. If H0H_0 is true, X2X^2 is approximately χ2\chi^2 distributed. A small value means the data are close to the model; a large value means they are far from it. Under the model Ei=n×P(cell i)E_i=n\times P(\text{cell } i), and the expected frequencies must add up to the total frequency nn. Yates' correction is not required.

Key termsobserved frequencyexpected frequencytest statistic
Exam tip

Check that ∑Ei=∑Oi\sum E_i=\sum O_i before you calculate X2X^2. If not, a probability or the last cell is wrong.

Section 3

Finding expected frequencies for each distribution

Discrete uniform (a fair die, nn throws): every cell has Ei=n6E_i=\frac{n}{6}. For example, 120 throws gives E=20E=20 per face. Continuous uniform on [a,b][a,b]: a class of width ww has probability wb−a\frac{w}{b-a}. Waiting times uniform on 0 to 20 minutes in four classes of width 5 give P=0.25P=0.25 each. Binomial B(n,p)B(n,p): Ei=N×P(X=i)E_i=N\times P(X=i). If pp is not given, estimate it as p^=sample meann\hat p=\frac{\text{sample mean}}{n}. Poisson Po(λ)Po(\lambda): Ei=N×P(X=i)E_i=N\times P(X=i), and estimate λ\lambda by the sample mean. Make the last cell 'rr or more', with E=N−∑E=N-\sum of the others. Normal N(μ,σ2)N(\mu,\sigma^2): Ei=N×P(class)E_i=N\times P(\text{class}), found by standardising with Z=X−μσZ=\frac{X-\mu}{\sigma}. The two end classes extend to ±∞\pm\infty.

Key termsdiscrete uniformcontinuous uniformestimated parameter
Common mistake

Treating the sample mean of grouped Normal data as if it were given. It is an estimate, and it costs a degree of freedom.

Section 4

Combining cells

The χ2\chi^2 approximation is only reliable if every expected frequency is at least 5. If any Ei<5E_i<5, combine it with a neighbouring cell, adding both the expected and the observed frequencies, and repeat until every Ei≥5E_i\ge5. For a Poisson model the small cells are usually in the tail, so combine into 'rr or more'. Check the combined value: with E=3.45E=3.45 and 1.171.17 the total 4.624.62 is still below 5, so a third cell must be added. The number of cells kk used in the degrees of freedom is the number after combining.

Key termscombining cellsexpected frequency rule
Common mistake

Combining the observed frequencies only, or checking Oi≥5O_i\ge5 instead of Ei≥5E_i\ge5.

Section 5

Degrees of freedom

ν=k−1−m,\nu=k-1-m, where kk is the number of cells after combining and mm is the number of parameters estimated from the data. One degree of freedom is lost because the total of the expected frequencies is fixed. No parameters estimated (a die, a uniform distribution with given limits, a fully specified binomial, Poisson or Normal): ν=k−1\nu=k-1. Binomial with pp estimated, or Poisson with λ\lambda estimated: ν=k−2\nu=k-2. Normal with μ\mu and σ2\sigma^2 both estimated: ν=k−3\nu=k-3.

Key termsdegrees of freedom
Exam tip

Write ν=k−1−m\nu=k-1-m with the actual numbers; method marks are given for showing what kk and mm were.

Section 6

Carrying out the test, and contingency tables

  1. State H0H_0 and H1H_1.
  2. Find the expected frequencies and combine cells where Ei<5E_i<5.
  3. Calculate X2=∑(Oi−Ei)2EiX^2=\sum\frac{(O_i-E_i)^2}{E_i}.
  4. State ν\nu and the critical value of χν2\chi^2_\nu at the stated significance level, from the tables.
  5. Reject H0H_0 if X2X^2 is greater than the critical value; otherwise there is insufficient evidence to reject it. Conclude in context. Example: a die gives frequencies 14, 25, 17, 22, 24, 18 in 120 throws. E=20E=20, X2=9420=4.7X^2=\frac{94}{20}=4.7, ν=5\nu=5 and the 5% critical value is 11.07011.070. Since 4.7<11.074.7<11.07, there is no evidence that the die is unfair. The same statistic ∑(Oi−Ei)2Ei\sum\frac{(O_i-E_i)^2}{E_i} is used to test contingency tables, covered later in this unit.
Key termscritical valuesignificance level
Common mistake

Writing 'accept H0H_0' as if it were proved. Write 'insufficient evidence to reject H0H_0, so the model is a suitable fit'.

That's the notes covered.

Carry on to the next subtopic.

Exam questions on Chi-squared goodness of fit tests

  1. A die is thrown 120 times. Faces 1 to 6 occurred 14, 25, 17, 22, 24 and 18 times respectively. A χ2\chi^2 goodness of fit test is to be used to test whether the die is fair.
    Calculate the value of the test statistic ∑(Oi−Ei)2Ei\sum\frac{(O_i-E_i)^2}{E_i}.2 marks
  2. A firm records the number of machine breakdowns in each of 100 weeks. No breakdowns occurred in 27 weeks, 1 in 35 weeks, 2 in 22 weeks, 3 in 11 weeks, 4 in 4 weeks and 5 in 1 week. The mean number of breakdowns per week is 1.33. The firm models the weekly number of breakdowns by a Poisson distribution with mean 1.33. The expected frequencies are 26.45, 35.18, 23.39, 10.37, 3.45 and 1.17 for 0, 1, 2, 3, 4 and 5 or more breakdowns respectively.
    Calculate the value of the test statistic for the combined cells.2 marks
  3. An inspector tests 120 boxes, each containing 4 bulbs, and records the number of defective bulbs in each box. There were 48 boxes with no defective bulbs, 42 with 1, 22 with 2, 7 with 3 and 1 with 4. The inspector suggests that the number of defective bulbs in a box can be modelled by B(4,p)B(4,p), with pp estimated from the data.
    State suitable hypotheses and show that the estimate of pp is 0.231 to 3 significant figures.3 marks
See the full worksheet

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).