All revision notes topics

Contingency tables and the chi-squared testAQA A-Level Further Maths: Revision notes

Section 1

Contingency tables and hypotheses

A contingency table shows observed frequencies for two categorical variables, with nn rows and mm columns. The chi-squared test checks whether the variables are associated.

  • H0H_0: there is no association between the variables (they are independent).
  • H1H_1: there is an association. Always state the hypotheses in the context of the question.
Key termscontingency tableassociation

Section 2

Expected frequencies

If H0H_0 is true, the expected frequency in each cell is E=row total×column totalgrand total.E=\frac{\text{row total}\times\text{column total}}{\text{grand total}}. Worked example: 150 employees, 40 walk, 70 live in town. Expected number who walk and live in town =40×70150=18.67=\frac{40\times70}{150}=18.67. Check that the expected frequencies have the same row and column totals as the observed table.

Key termsexpected frequency
Common mistake

Rounding expected frequencies to whole numbers. Keep at least one decimal place.

Section 3

The test statistic and degrees of freedom

The test statistic is X2=∑(Oi−Ei)2Ei,X^2=\sum\frac{(O_i-E_i)^2}{E_i}, which is approximately chi-squared when H0H_0 is true. For an n×mn\times m table the degrees of freedom are ν=(n−1)(m−1).\nu=(n-1)(m-1). Large values of X2X^2 mean the observed frequencies are far from those expected under H0H_0. Compare with the upper-tail critical value: at the 5%5\% level these are 3.8413.841 (ν=1\nu=1), 5.9915.991 (ν=2\nu=2), 7.8157.815 (ν=3\nu=3) and 9.4889.488 (ν=4\nu=4). If X2X^2 exceeds the critical value, reject H0H_0.

Key termstest statisticdegrees of freedom
Exam tip

The test is one-tailed: only a large X2X^2 gives evidence of association. A very small X2X^2 just means the data fit independence closely.

Section 4

The expected frequency convention

The chi-squared approximation is only reliable when all expected frequencies are greater than 5. If any Ei≤5E_i\le5, combine adjacent categories (rows or columns) so that every expected frequency is greater than 5, recalculate, and use the reduced degrees of freedom for the new table. Example: expected frequencies of 4.24.2, 3.63.6 and 4.24.2 in a 'not at all' column mean it should be combined with the neighbouring category, giving a table with fewer columns and ν\nu reduced.

Key termscombine categories
Common mistake

Using the original degrees of freedom after combining categories. Recalculate ν\nu from the new table.

Section 5

Identifying sources of association

If H0H_0 is rejected, find which cells cause it by looking at each contribution (O−E)2E\frac{(O-E)^2}{E}. The cells with the largest contributions are the main sources of association. Compare OO with EE for those cells and describe the pattern in context. Example: at clinic Z, 20 dissatisfied patients were observed against 11.7 expected (contribution 5.955.95), so dissatisfaction is higher at Z than independence predicts, while a clinic with contributions close to zero follows the overall pattern.

Key termssource of association
Exam tip

Say 'more than expected' or 'fewer than expected', quoting OO and EE, and always relate it to the context.

That's the notes covered.

Carry on to the next subtopic.

Exam questions on Contingency tables and the chi-squared test

  1. A survey of 150 employees records how they travel to work and whether they live in town. Of the 40 who walk, 30 live in town. Of the 60 who take the bus, 25 live in town. Of the 50 who drive, 15 live in town. A chi-squared test for association is to be carried out.
    State the null hypothesis and the number of degrees of freedom for the test.2 marks
  2. Hospital records for 200 patients from three wards, A, B and C, give each patient's recovery outcome. Ward A has 70 patients: 48 recovered fully, 20 partially and 2 not at all. Ward B has 60 patients: 35 fully, 22 partially and 3 not at all. Ward C has 70 patients: 27 fully, 36 partially and 7 not at all.
    Explain why two of the outcome categories must be combined before the test is carried out, and state the degrees of freedom after doing so.2 marks
  3. A cafe owner records the drink chosen by 120 customers: 60 in the morning and 60 in the afternoon. In the morning, 18 chose tea, 30 chose coffee and 12 chose juice. In the afternoon, 24 chose tea, 14 chose coffee and 22 chose juice.
    Find the expected frequency for each cell, assuming the drink is independent of the time of day, and calculate the value of the test statistic ∑(O−E)2E\sum\frac{(O-E)^2}{E}.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).