In short
The chi-square statistic is , summed over every cell. Large values mean the observed counts are far from what H₀ predicts. The p-value is the area to the right of χ² under the chi-square curve with (r − 1)(c − 1) degrees of freedom. After a significant result, the largest components show where the biggest departures from H₀ are.
What you need to know
- Calculate the chi-square statistic from observed and expected counts.
- Find the p-value using the chi-square distribution with the correct df.
- Conclude a homogeneity or independence test in context.
- Use components to describe where the evidence comes from.
The chi-square statistic and distribution
Each cell contributes (O − E)²/E, its component. Squaring makes every component positive, so χ² is never negative, and dividing by E puts a difference of 10 from an expected 20 on a bigger scale than a difference of 10 from an expected 200. If H₀ is true, χ² follows (approximately) a chi-square distribution: right-skewed, starting at 0, with mean equal to its degrees of freedom. The p-value is always the upper-tail area.
Example 1: homogeneity (not significant)
From topic 3.14: independent random samples of 100 students at School X and School Y; observed counts X: 45, 30, 25 and Y: 30, 40, 30 (flashcards, videos, notes); expected counts 37.5, 35, 27.5 in each row. Conditions were met (smallest expected count 27.5). Use α = 0.05.
With df = 2, P(χ² ≥ 4.88) ≈ 0.087 (calculator: χ²cdf(4.88, 1E99, 2), or χ²-Test on the matrix of observed counts).
Conclude. Because 0.087 > 0.05, we fail to reject H₀. There is not convincing evidence that the distribution of preferred revision method differs between all students at School X and all students at School Y. The sample differences (45% vs 30% flashcards) could plausibly be due to sampling variability.
Example 2: independence (significant)
One random sample of 300 students at a large school was classified by year and plan. Juniors: 90 university, 30 work, 30 undecided. Seniors: 66 university, 42 work, 42 undecided. Column totals 156, 72, 72; both row totals 150. Expected counts: 78, 36, 36 in each row (all at least 5). H₀: there is no association between year and plan among all students at the school. α = 0.05.
Components: (90 − 78)²/78 ≈ 1.846, (30 − 36)²/36 = 1.000, (30 − 36)²/36 = 1.000, and the same three again for seniors. So χ² ≈ 7.69 with df = 2, giving p-value ≈ 0.021.
Conclude. Because 0.021 < 0.05, reject H₀. There is convincing evidence of an association between year and plan after school among all students at the school. The largest components are for university: juniors chose it more often than expected (90 vs 78) and seniors less often (66 vs 78).
Key terms
- Chi-square statistic χ²
- Σ(observed − expected)²/expected over all cells; measures how far the counts are from H₀.
- Component
- One cell's contribution (O − E)²/E to χ².
- Chi-square distribution
- A right-skewed distribution of non-negative values, determined by its degrees of freedom.
- χ²-Test
- The calculator routine that takes a matrix of observed counts and returns χ², df and the p-value.
Common mistakes
Using a two-tailed p-value.
Chi-square p-values are always the area to the right of χ².
Entering percentages into the matrix.
Use counts.
Concluding 'the variables are independent' after failing to reject.
Say there is not convincing evidence of an association.
How this topic is tested
- Show at least one component calculation and the sum.
- State df and the p-value together: 'χ² = 4.88, df = 2, p ≈ 0.087'.
- After a significant result, name the cell with the largest component and say whether observed was above or below expected.
Practice questions
Original AP-style multiple-choice questions. Pick an answer to see the explanation.
Question 1 · SP 3 · Analyze Data
A cell has observed 50 and expected 40. Its contribution to χ² is:
Question 2 · SP 3 · Analyze Data
For χ² = 7.2 with df = 3, the p-value is about:
Question 3 · SP 4 · Interpret Results
A test for independence gives p-value 0.30. The best conclusion is:
Question 4 · SP 3 · Analyze Data
Why is a chi-square p-value always an upper-tail area?
Question 5 · SP 4 · Interpret Results
After a significant chi-square test, a cell has the largest component, with observed 12 and expected 25. This means:
Free-response practice
Write your answer first, then mark it against the scoring guide.
Inference (full test) · 4 points
Independent random samples of 100 customers at two branches of a bank rated service as poor, fair or good. Branch 1: 60 good, 40 not good; Branch 2: 45 good, 55 not good (collapsed into two categories). χ²-Test gives χ² ≈ 4.51, df = 1.
- (a) State the hypotheses and check the conditions.
- (b) Find the p-value.
- (c) Conclude at α = 0.05.
Scoring guide: one point for each of the following
Part (a)
- H₀: the distribution of service rating (good / not good) is the same for all customers of both branches; Hₐ: it is not the same.
- Independent random samples; expected counts 52.5 and 47.5 in each row are at least 5.
Part (b)
- P(χ² ≥ 4.51) with df = 1 ≈ 0.034.
Part (c)
- Because 0.034 < 0.05, reject H₀: convincing evidence that the distribution of service ratings differs between the two branches' customers.
Connected topics
Frequently asked questions
Do I need to list every expected count?
Show one calculation and give the rest, or say all are at least 5 with the smallest value stated.
What does df mean in practice?
It is the number of cells that can vary freely once the row and column totals are fixed.
Can a chi-square test tell me which groups differ?
Not formally, but the largest components point to where the biggest differences from H₀ are.