Further Statistics: Chi-Squared Tests (Goodness of Fit and Contingency Tables)
In A-level Further Statistics, a chi-squared test compares a set of OBSERVED frequencies O from sample data against a set of EXPECTED frequencies E predicted by a hypothesised model, using the test statistic X^2 = sum (O-E)^2/E. A goodness-of-fit test checks whether data follows a specified discrete distribution or a given ratio of proportions, with degrees of freedom v = (number of categories) - 1 (minus one more for each parameter estimated from the sample). A contingency table test checks whether two categorical variables are associated, using expected frequency (row total x column total)/grand total in each cell, with degrees of freedom v = (rows-1)(columns-1). In both cases X^2 is compared with a critical value from chi-squared tables at the given significance level: if X^2 exceeds the critical value, H0 is rejected.
Before you start
Make sure you're comfortable with these topics first:
Method
- State H0 and H1 clearly: for goodness of fit, H0 is that the data follows the given distribution or ratio and H1 is that it does not; for a contingency table, H0 is that the two variables are independent and H1 is that they are associated.
- Calculate the expected frequency E for every category or cell: (hypothesised probability) x (total frequency) for goodness of fit, or (row total x column total)/grand total for each cell of a contingency table.
- Check the validity condition before testing: if any expected frequency is below 5, pool (combine) that category or cell with a neighbouring one, adding the corresponding observed frequencies, and reduce the number of categories used accordingly.
- Calculate the test statistic X^2 = sum (O-E)^2/E over every category or cell remaining after any pooling.
- Find the degrees of freedom (v = categories - 1 - estimated parameters for goodness of fit, or v = (rows-1)(columns-1) for a contingency table) and compare X^2 with the critical value at the stated significance level.
- State the conclusion in the context of the question: if X^2 exceeds the critical value, reject H0 (there is evidence of a difference from the model, or of association); otherwise there is insufficient evidence to reject H0.
Worked example
A gaming die is suspected of being biased. It is rolled 120 times and the observed frequencies of each score are: score 1: 15, score 2: 25, score 3: 18, score 4: 22, score 5: 14, score 6: 26. Test, at the 5% significance level, whether the die is fair. You may use the critical value chi^2 with 5 degrees of freedom at the 5% level = 11.070.
- State the hypotheses: H0: the die is fair (each score has probability 1/6); H1: the die is not fair.
- Under H0, the expected frequency for every score is E = 120 x 1/6 = 20, and no expected frequency is below 5, so no pooling is needed.
- Calculate (O-E)^2/E for each score: (15-20)^2/20 = 1.25; (25-20)^2/20 = 1.25; (18-20)^2/20 = 0.2; (22-20)^2/20 = 0.2; (14-20)^2/20 = 1.8; (26-20)^2/20 = 1.8.
- Sum these six contributions: X^2 = 1.25 + 1.25 + 0.2 + 0.2 + 1.8 + 1.8 = 6.5.
- The degrees of freedom are v = 6 categories - 1 = 5, so compare X^2 with the given critical value 11.070.
- Final answer: since X^2 = 6.5 is less than 11.070, there is insufficient evidence at the 5% level to reject H0 - the die can be considered fair.
Practice questions
Try each question, then tap to reveal the answer.
Q1Write down the formula for the chi-squared test statistic used to compare a set of observed frequencies O with a set of expected frequencies E.Show answer
Answer: X^2 = sum (O-E)^2 / E, summed over every category or cell
Q2State the null hypothesis used in a chi-squared goodness-of-fit test for whether data follows a given probability distribution.Show answer
Answer: H0: the data follows the given (stated) probability distribution; H1: the data does not follow the given distribution
Q3A goodness-of-fit test uses 7 categories, and no parameters were estimated from the sample. State the degrees of freedom.Show answer
Answer: v = 7 - 1 = 6
Q4A contingency table has 3 rows and 4 columns. State the number of degrees of freedom for the chi-squared test of association.Show answer
Answer: v = (3-1)(4-1) = 2 x 3 = 6
Q5In a chi-squared test, an expected frequency in one category comes out as 3.2. Explain what should be done before calculating the test statistic.Show answer
Answer: The category with expected frequency below 5 should be combined (pooled) with a neighbouring category, with the observed frequencies added together, before recalculating the degrees of freedom
Q6One category has observed frequency 34 and expected frequency 28. Find the contribution (O-E)^2/E made by this category to the test statistic.Show answer
Answer: (34-28)^2/28 = 36/28 = 9/7 (approximately 1.29)
Q7A chi-squared goodness-of-fit test statistic is calculated as X^2 = 8.2 with 3 degrees of freedom. Using the critical value 7.815 for 3 degrees of freedom at the 5% level, state the conclusion of the test.Show answer
Answer: Since 8.2 > 7.815, reject H0: there is evidence at the 5% level that the data does not fit the proposed distribution
Exam-style questions
Written in the style of a A Level Further Maths exam paper, with a full mark scheme.
A spinner is designed so that the probability of landing on red, blue and green is in the ratio 2:3:5. The spinner is spun 200 times, giving observed frequencies: red 36, blue 66, green 98. Test, at the 5% significance level, whether the spinner performs as designed. You may use the critical value 5.991 for 2 degrees of freedom at the 5% level.
Show mark scheme
Tick each line you got. Your score builds from the marks on the scheme.
Nothing ticked yet - 5 available
A survey of 100 students records their gender and whether they study Further Maths: of 50 male students, 18 study Further Maths and 32 do not; of 50 female students, 10 study Further Maths and 40 do not. Test, at the 5% significance level, whether there is an association between gender and studying Further Maths, applying Yates' continuity correction X^2 = sum (|O-E|-0.5)^2/E to this 2 by 2 table. You may use the critical value 3.841 for 1 degree of freedom at the 5% level.
Show mark scheme
Tick each line you got. Your score builds from the marks on the scheme.
Nothing ticked yet - 6 available
A survey asks 90 people how many pets they own, and the results are compared with a claimed probability distribution: P(0 pets) = 0.5, P(1 pet) = 0.3, P(2 pets) = 0.15, P(3 or more pets) = 0.05. The observed frequencies are: 0 pets: 40, 1 pet: 30, 2 pets: 16, 3 or more pets: 4. (a) Show that the expected frequency for '3 or more pets' is too small to use directly, and explain how the categories should be pooled. (b) Carry out a chi-squared goodness-of-fit test at the 5% significance level, using the critical value 5.991 for 2 degrees of freedom (after pooling).
Show mark scheme
Tick each line you got. Your score builds from the marks on the scheme.
Nothing ticked yet - 6 available
See real A Level Further Maths past-paper questions, with official mark schemes →
Free printable worksheet
Want more practice on paper? Download the further statistics: chi-squared tests (goodness of fit and contingency tables) worksheet pack - 14 pages of exam-style questions with a full mark scheme. One email opens every download in this browser for 14 days - no account, no card. Print it for personal and classroom use.
Next topics
Not quite what you needed?
Tell us what is missing on further statistics: chi-squared tests (goodness of fit and contingency tables), or which topic to write up next. Every request is read, and we reply to every one.
Build a full practice pack.
This topic is one of hundreds in the library - pick the ones a student needs and generate a printable PDF in minutes.