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 rows and columns. The chi-squared test checks whether the variables are associated.
- : there is no association between the variables (they are independent).
- : there is an association. Always state the hypotheses in the context of the question.
Section 2
Expected frequencies
If is true, the expected frequency in each cell is Worked example: 150 employees, 40 walk, 70 live in town. Expected number who walk and live in town . Check that the expected frequencies have the same row and column totals as the observed table.
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 which is approximately chi-squared when is true. For an table the degrees of freedom are Large values of mean the observed frequencies are far from those expected under . Compare with the upper-tail critical value: at the level these are (), (), () and (). If exceeds the critical value, reject .
The test is one-tailed: only a large gives evidence of association. A very small 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 , 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 , and in a 'not at all' column mean it should be combined with the neighbouring category, giving a table with fewer columns and reduced.
Using the original degrees of freedom after combining categories. Recalculate from the new table.
Section 5
Identifying sources of association
If is rejected, find which cells cause it by looking at each contribution . The cells with the largest contributions are the main sources of association. Compare with for those cells and describe the pattern in context. Example: at clinic Z, 20 dissatisfied patients were observed against 11.7 expected (contribution ), so dissatisfaction is higher at Z than independence predicts, while a clinic with contributions close to zero follows the overall pattern.
Say 'more than expected' or 'fewer than expected', quoting and , 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
- 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
- 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
- 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 .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).