All AP Courses AP StatisticsAP Stats

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 H0 were true. Each expected count is (row total)(column total) divided by the grand total. The statistic adds (observed−expected)2expected 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 printPrefers ebookNo preferenceTotal
Grade 9 to 10363040106
Grade 11 to 12418286209
Total77112126315

Find the p-value. Round to four decimal places.

Solution

  1. 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.
  2. χ2=∑(O−E)2E≈8.49 with df = (rows − 1)(columns − 1) = 2.
  3. p-value = P(χ² > 8.49) ≈ 0.0143.

Answer: 0.0143

Your turn

Lessons behind these problems