Practice
Chi-square tests for two-way tables
Expected counts, the chi-square statistic, degrees of freedom and the p-value.
The skill
A chi-square test for a two-way table compares observed counts with the counts expected if were true. Each expected count is (row total)(column total) divided by the grand total. The statistic adds over every cell, with degrees of freedom (rows minus 1)(columns minus 1). Check that every expected count is greater than 5; that condition is about expected counts, not observed ones. The design decides the name: independence for one sample, homogeneity for separate samples or groups.
A worked example
The table shows a random sample of students at one school, classified by grade band and reading preference. You will carry out a chi-square test for independence.
| Prefers print | Prefers ebook | No preference | Total | |
|---|---|---|---|---|
| Grade 9 to 10 | 36 | 30 | 40 | 106 |
| Grade 11 to 12 | 41 | 82 | 86 | 209 |
| Total | 77 | 112 | 126 | 315 |
Find the p-value. Round to four decimal places.
Solution
- Find each cell's expected count, (row total)(column total) / (grand total): 25.91, 37.69, 42.40, 51.09, 74.31, 83.60, reading across the rows. Every one is greater than 5, so the expected counts condition is met.
- with df = (rows − 1)(columns − 1) = 2.
- p-value = P(χ² > 8.49) ≈ 0.0143.
Answer: 0.0143