You surveyed three separate random samples — 200 teenagers, 200 working adults, and 200 retirees — and asked each person how they mainly watch TV: Streaming, Cable, or Neither. You make a side-by-side bar graph and the bars look different across the three age groups. Teens lean heavily toward streaming; retirees lean toward cable.
Here's the question that should be nagging you: could those differences just be sampling noise? If the three age groups really watched TV the same way, you'd still expect three random samples to come out a little different. So how different is "too different to be chance"?
In Lesson 23 you compared two proportions. But now you have three groups and a categorical response with three categories — too much to squeeze into a single difference of proportions. You need one test that compares entire distributions across several groups at once. That test is the chi-square (χ²) test for homogeneity. Let's build it.
Use the chi-square test for homogeneity when you have one categorical response variable measured on two or more groups (or populations) that came from separate samples — or from a randomized experiment with several treatment groups — and you want to know whether the distribution of that response is the same across all the groups.
Three signals that it's a homogeneity test:
Heads up — this is NOT a goodness-of-fit test. Goodness-of-fit (one sample, one variable, compared to a hypothesized set of proportions) is not on the new exam. And it's not a test for independence either (that's Lesson 25 — one sample, two variables measured on the same people). Homogeneity = several samples, one response variable, compare the distributions.
Lay the data out as a two-way table of counts (never percents — the test runs on raw counts). Put the groups in the rows and the response categories in the columns:
| Age group | Streaming | Cable | Neither | **Total** |
|---|---|---|---|---|
| Teens | 120 | 50 | 30 | 200 |
| Adults | 90 | 70 | 40 | 200 |
| Seniors | 60 | 90 | 50 | 200 |
| Total | 270 | 210 | 120 | 600 |
For homogeneity, write hypotheses in words about distributions, not symbols:
Note: Hₐ is just "the distributions are not all the same." It does not say which group differs or how. The chi-square test is a single yes/no question about the whole table.
If H₀ is true, every group has the same distribution — so the best single estimate of that common distribution comes from the column totals (the pooled response). Overall, 270/600 = 45% stream, 210/600 = 35% cable, 120/600 = 20% neither. Under H₀, each group of 200 should split in those same proportions.
The shortcut formula gives the same answer:
E = (row total × column total) / grand total
Work one cell fully — Teens / Streaming:
E = (row total × column total) / grand total
E = (200 × 270) / 600
E = 54000 / 600
E = 90
Do this for all nine cells. Because all three row totals equal 200, every row gets the same expected counts here:
| Expected | Streaming | Cable | Neither |
|---|---|---|---|
| Teens | 90 | 70 | 40 |
| Adults | 90 | 70 | 40 |
| Seniors | 90 | 70 | 40 |
Now measure how far the observed (O) counts fall from the expected (E) counts:
χ² = Σ (O − E)² / E
Compute the contribution of each cell, (O − E)² / E, then add them all up. Two cells worked fully:
Teens / Streaming: (120 − 90)² / 90 = (30)²/90 = 900/90 = 10.000
Teens / Cable: (50 − 70)² / 70 = (−20)²/70 = 400/70 = 5.714
Doing all nine cells:
| Contribution `(O−E)²/E` | Streaming | Cable | Neither |
|---|---|---|---|
| Teens | 10.000 | 5.714 | 2.500 |
| Adults | 0.000 | 0.000 | 0.000 |
| Seniors | 10.000 | 5.714 | 2.500 |
χ² = 10.000 + 5.714 + 2.500 + 0 + 0 + 0 + 10.000 + 5.714 + 2.500
χ² = 36.429
df = (r − 1)(c − 1) where r = number of rows (groups) and c = number of columns (response categories). The grand total does not matter for df.
df = (3 − 1)(3 − 1) = (2)(2) = 4
The chi-square test is always right-tailed — a big χ² means big mismatch. Find the area to the right of your statistic:
p-value = χ²cdf(χ², 1E99, df)
χ²cdf(36.429, 1E99, 4) ≈ 0.0000002 (about 2.4 × 10⁻⁷)
Because p ≈ 0.0000002 < α = 0.05, we reject H₀. We have very strong evidence that the distribution of TV-watching preference is not the same across teens, adults, and seniors.
The chi-square test alone won't tell you how the groups differ — but the cell contributions will. The two biggest contributors (10.000 each) are Teens / Streaming (far more streamers than expected) and Seniors / Streaming (far fewer than expected). The "Adults" row contributed essentially nothing — adults landed right at the expected counts. So the differences are driven mainly by teens over-streaming and seniors under-streaming. Always report this when asked to describe the nature of the difference; never claim a specific group "differs" from a significant χ² alone without pointing to the contributions.
Problem. Two high schools each drew a random sample of 100 seniors and recorded whether the student passed a state exam. Find the expected counts under H₀.
| School | Pass | Fail | Total |
|---|---|---|---|
| North | 80 | 20 | 100 |
| South | 60 | 40 | 100 |
| Total | 140 | 60 | 200 |
Strategy. Apply E = (row total × column total) / grand total to each cell.
Solution.
North/Pass: (100 × 140)/200 = 70 North/Fail: (100 × 60)/200 = 30
South/Pass: (100 × 140)/200 = 70 South/Fail: (100 × 60)/200 = 30
| Expected | Pass | Fail |
|---|---|---|
| North | 70 | 30 |
| South | 70 | 30 |
Interpretation. Under "the pass-rate distribution is the same at both schools," each school of 100 should produce about 70 passes and 30 fails (the pooled rate is 140/200 = 70%). North did better than expected, South worse. All four expected counts are ≥ 5, so the test will be valid.
Problem. A chain took independent random samples of 100 customers at each of three cafés and asked their preferred drink: Coffee, Tea, or Other. Test at α = 0.05 whether the distribution of drink preference is the same across the three cafés.
| Café | Coffee | Tea | Other | Total |
|---|---|---|---|---|
| A | 45 | 35 | 20 | 100 |
| B | 30 | 40 | 30 | 100 |
| C | 25 | 45 | 30 | 100 |
| Total | 100 | 120 | 80 | 300 |
P — Parameter / hypotheses.
A — Assumptions (conditions).
Expected counts (E = row × col / grand):
| Expected | Coffee | Tea | Other |
|---|---|---|---|
| A | 33.33 | 40 | 26.67 |
| B | 33.33 | 40 | 26.67 |
| C | 33.33 | 40 | 26.67 |
Smallest expected count is 26.67 ≥ 5. ✓ Condition met.
N — Name the procedure. Chi-square test for homogeneity.
I — Inference (compute).
Largest contributions:
A/Coffee: (45 − 33.33)²/33.33 = 4.083
C/Coffee: (25 − 33.33)²/33.33 = 2.083
A/Other: (20 − 26.67)²/26.67 = 1.667
... (all nine cells summed)
χ² = 10.25
df = (3 − 1)(3 − 1) = 4
p = χ²cdf(10.25, 1E99, 4) ≈ 0.0364
C — Conclusion in context. Since p ≈ 0.0364 < α = 0.05, we reject H₀. There is convincing evidence that the distribution of drink preference is not the same across the three cafés. The largest cell contributions come from Café A (more coffee than expected) and Café C (less coffee than expected), so the difference is driven mainly by how coffee preference varies between A and C.
Problem. Researchers randomly assigned 180 patients with chronic pain to three treatments (Drug X, Drug Y, Placebo), 60 per group, and recorded each patient's outcome after 8 weeks: Improved, No Change, or Worse. Test at α = 0.05 whether the distribution of outcomes is the same across the three treatments.
| Treatment | Improved | No Change | Worse | Total |
|---|---|---|---|---|
| Drug X | 38 | 12 | 10 | 60 |
| Drug Y | 30 | 18 | 12 | 60 |
| Placebo | 22 | 20 | 18 | 60 |
| Total | 90 | 50 | 40 | 180 |
P. H₀: the distribution of outcomes (Improved/No Change/Worse) is the same for all three treatments. Hₐ: it is not the same for all three. α = 0.05.
A. Random — patients were randomly assigned to treatments (a randomized experiment), so the Random condition is met. The 10% condition does not apply in a randomized experiment (we are not sampling without replacement from a population — note that). Large counts — expected counts below.
Expected counts: every treatment has row total 60, so each row is identical:
E(Improved) = 60 × 90/180 = 30
E(No Change) = 60 × 50/180 = 16.67
E(Worse) = 60 × 40/180 = 13.33
Smallest expected count = 13.33 ≥ 5. ✓
N. Chi-square test for homogeneity.
I.
Biggest contributions:
X/Improved: (38 − 30)²/30 = 2.133
Placebo/Improved: (22 − 30)²/30 = 2.133
Placebo/Worse: (18 − 13.33)²/13.33 = 1.633
... (all nine cells)
χ² = 8.947
df = (3 − 1)(3 − 1) = 4
p = χ²cdf(8.947, 1E99, 4) ≈ 0.0624
C. Since p ≈ 0.0624 > α = 0.05, we fail to reject H₀. We do not have convincing evidence that the distribution of outcomes differs across the three treatments. (Notice the pattern looks suggestive — Drug X improved most, Placebo least — but with this sample size the differences are not strong enough to rule out chance. "Fail to reject" never means "the distributions are the same"; it means we lack evidence that they differ.)
1. Running the test on percents instead of counts. Students convert each row to percentages and feed those in. The chi-square statistic depends on sample size — percents throw the counts away. Always use raw observed counts, and remember expected counts also come out as counts (decimals are fine: 26.67 is a legal expected count).
2. Using the wrong degrees of freedom. A common error is df = number of cells − 1 or df = n − 1. For a two-way table it is (rows − 1)(columns − 1). For the 3×3 tables above that's (2)(2) = 4, not 8 and not 599. The grand total never enters df.
3. Forgetting the "all expected counts ≥ 5" condition — and checking observed instead. The Large-Counts condition is about expected counts, not observed. A cell can have an observed count of 2 and still be fine if its expected count is ≥ 5. Always compute the expected counts and cite the smallest one.
4. Claiming which group differs (or "how") straight from a significant χ². A small p-value tells you the distributions differ somewhere — it does not identify the group or direction. To say how they differ you must point to the cell contributions (O−E)²/E and compare observed vs. expected. Don't write "teens prefer streaming more" as a conclusion of the test; write it as a follow-up supported by the contributions.
5. Mixing up homogeneity with independence or goodness-of-fit. Several separate samples + one response = homogeneity. One sample + two variables on the same people = independence (Lesson 25). One sample vs. a claimed distribution = goodness-of-fit, which is not on this exam. The math for homogeneity and independence is identical; the design and hypotheses wording differ.
MC 1. A homogeneity test compares one categorical response across 4 groups, with the response having 3 categories. The degrees of freedom are:
(A) 2 (B) 6 (C) 11 (D) 12
MC 2. In a two-way table the cell with row total 100, column total 80, and grand total 200 has expected count:
(A) 16 (B) 40 (C) 50 (D) 80
MC 3. A χ² test for homogeneity gives χ² = 14.2 with df = 6. Using χ²cdf(14.2, 1E99, 6) ≈ 0.0276, at α = 0.05 the correct decision is:
(A) Fail to reject H₀; the distributions are the same.
(B) Reject H₀; there is convincing evidence the distributions differ.
(C) Fail to reject H₀; there is convincing evidence the distributions differ.
(D) Reject H₀; the distributions are the same.
MC 4. Which scenario calls for a chi-square test for homogeneity?
(A) One random sample of 500 adults classified by both political party and region.
(B) One sample of 200 dice rolls compared to the expected uniform distribution.
(C) Separate random samples from three cities, each classified by preferred news source.
(D) Two means compared with a two-sample t-test.
MC 5. For the χ² test for homogeneity, the alternative hypothesis states:
(A) All group distributions are equal.
(B) A specific named group differs from the others.
(C) The distribution of the response is not the same for all groups.
(D) The two variables are independent.
MC 6. A test produces these cell contributions (O−E)²/E: 0.1, 0.2, 5.8, 0.3, 6.1, 0.0. The χ² statistic is:
(A) 6.1 (B) 5.8 (C) 12.5 (D) 2.08
MC 7. Increasing every observed count in a homogeneity table by a factor of 10 (10× more data, same proportions) will:
(A) Leave χ² unchanged. (B) Multiply χ² by about 10.
(C) Divide χ² by 10. (D) Multiply χ² by 100.
MC 8. A homogeneity test has one expected count of 3.4 while all observed counts exceed 8. The correct response is:
(A) Proceed; observed counts are all large enough.
(B) The Large-Counts condition is not met; the result may be unreliable.
(C) Switch to a goodness-of-fit test.
(D) Increase the degrees of freedom to compensate.
Short Answer 9 (in context). Three independent random samples of 100 commuters in three neighborhoods were asked their main commute mode: Car, Transit, or Bike. The table:
| Neighborhood | Car | Transit | Bike | Total |
|---|---|---|---|---|
| Hillside | 30 | 45 | 25 | 100 |
| Riverton | 50 | 35 | 15 | 100 |
| Total | 80 | 80 | 40 | 200 |
(a) State H₀ and Hₐ in words. (b) Compute the expected counts. (c) Find χ², df, and the p-value. (d) Conclude at α = 0.05.
Short Answer 10 (in context). Explain, in one or two sentences, why a researcher who gets a significant χ² for homogeneity across four brands cannot immediately conclude "Brand C is the one that's different" — and what they should examine instead.
Practices assessed: 3 — Analyze Data; 4 — Interpret Results.
A school district wants to know whether students' preferred social media platform differs by grade level. From three grade levels, the district takes separate independent random samples of 100 students each and records each student's single most-used platform: App-V (short video), App-P (photos), or App-T (text/chat).
| Grade | App-V | App-P | App-T | Total |
|---|---|---|---|---|
| 9th | 55 | 30 | 15 | 100 |
| 10th | 40 | 35 | 25 | 100 |
| 11th | 25 | 40 | 35 | 100 |
| Total | 120 | 105 | 75 | 300 |
(a) State the hypotheses for an appropriate test. (2 pts)
(b) Identify the test and verify that the conditions for inference are met. (3 pts)
(c) Calculate the test statistic, degrees of freedom, and p-value. (3 pts)
(d) State your conclusion in context at α = 0.05, and identify which cells contribute most to the result. (2 pts)
(a) Hypotheses.
(b) Procedure and conditions. Chi-square test for homogeneity (one categorical response compared across three separately sampled groups).
| Expected | App-V | App-P | App-T |
|---|---|---|---|
| 9th | 40 | 35 | 25 |
| 10th | 40 | 35 | 25 |
| 11th | 40 | 35 | 25 |
Smallest expected count = 25 ≥ 5. ✓
(c) Test statistic, df, p-value.
χ² = Σ (O − E)²/E
= (55−40)²/40 + (30−35)²/35 + (15−25)²/25
+ (40−40)²/40 + (35−35)²/35 + (25−25)²/25
+ (25−40)²/40 + (40−35)²/35 + (35−25)²/25
= 5.625 + 0.714 + 4.000 + 0 + 0 + 0 + 5.625 + 0.714 + 4.000
χ² = 20.68
df = (3 − 1)(3 − 1) = 4
p = χ²cdf(20.68, 1E99, 4) ≈ 0.00037
(d) Conclusion. Since p ≈ 0.00037 < α = 0.05, we reject H₀. There is convincing evidence that the distribution of preferred social media platform is not the same across the three grade levels. The largest cell contributions (about 5.6 each) come from 9th/App-V (far more short-video fans than expected) and 11th/App-V (far fewer than expected), so the difference is driven mainly by a decline in App-V preference and a rise in App-T preference from 9th to 11th grade.
| Part | Points | Earned by |
|---|---|---|
| (a) Hypotheses | 2 | 1 pt — H₀ states the distribution of platform is the same across grades, in context. 1 pt — Hₐ states the distribution is not the same for all grades (not "different for one specific grade"). |
| (b) Procedure + conditions | 3 | 1 pt — names χ² test for homogeneity. 1 pt — Random (independent random samples) and 10% addressed. 1 pt — Large Counts: states all expected counts ≥ 5 and gives/uses the expected counts (smallest = 25). |
| (c) Calculation | 3 | 1 pt — correct χ² ≈ 20.68 (with formula or correct work shown). 1 pt — correct df = 4 from (r−1)(c−1). 1 pt — correct p-value ≈ 0.00037 (or "< 0.001") consistent with χ² and df. |
| (d) Conclusion | 2 | 1 pt — correct decision (reject H₀) linked to comparing p to α, with a context conclusion about the distributions differing across grades. 1 pt — identifies the largest-contributing cells (9th/App-V and 11th/App-V) to describe how the groups differ. |
Total: 10 points.
χ²cdf(χ², 1E99, df).MC 1 — (B) 6. df = (4−1)(3−1) = 3 × 2 = 6. (A) treats it as (c−1); (C) is cells − 1 = 12 − 1; (D) is the number of cells.
MC 2 — (B) 40. E = (100 × 80)/200 = 8000/200 = 40. (A) multiplies row × col / something wrong (80×100/500-style); (C) and (D) ignore the formula.
MC 3 — (B). p ≈ 0.0276 < 0.05 → reject H₀; convincing evidence the distributions differ. (A)/(D) reach the wrong decision; (C) keeps H₀ but claims evidence — contradictory. Also note: you never conclude distributions "are the same."
MC 4 — (C). Several separate random samples (three cities), one categorical response (news source) = homogeneity. (A) is one sample with two variables → independence. (B) is goodness-of-fit (not on this exam). (D) is a means test, not categorical.
MC 5 — (C). Hₐ for homogeneity: the response distribution is not the same across all groups. (A) is H₀; (B) is too specific (a χ² test never names the group); (D) is the wording for an independence test.
MC 6 — (C) 12.5. χ² is the sum of all contributions: 0.1 + 0.2 + 5.8 + 0.3 + 6.1 + 0.0 = 12.5. (A)/(B) pick a single cell.
MC 7 — (B) Multiply by ~10. Each (O−E)²/E scales with sample size; 10× the counts (same proportions) makes every numerator 100× and denominator 10×, so each contribution ×10 → χ² ×10. This is exactly why you must use counts, not percents (MC distractor logic for Common Mistake 1).
MC 8 — (B). One expected count of 3.4 < 5 violates the Large-Counts condition regardless of how big the observed counts are; the test may be unreliable. (A) checks the wrong counts; (C)/(D) are not valid fixes.
(a) H₀: the distribution of commute mode (Car/Transit/Bike) is the same in Hillside and Riverton. Hₐ: the distribution of commute mode is not the same in the two neighborhoods.
(b) Expected counts (E = row × col / grand, grand = 200; each row total 100):
| Expected | Car | Transit | Bike |
|---|---|---|---|
| Hillside | 40 | 40 | 20 |
| Riverton | 40 | 40 | 20 |
(e.g., Hillside/Car = 100 × 80 / 200 = 40.) Smallest expected = 20 ≥ 5. ✓
(c)
`
χ² = (30−40)²/40 + (45−40)²/40 + (25−20)²/20
+ (50−40)²/40 + (35−40)²/40 + (15−20)²/20
= 2.50 + 0.625 + 1.25 + 2.50 + 0.625 + 1.25
χ² = 8.75
df = (2 − 1)(3 − 1) = 2
p = χ²cdf(8.75, 1E99, 2) ≈ 0.0126
`
(d) Since p ≈ 0.0126 < α = 0.05, reject H₀. There is convincing evidence that the distribution of commute mode differs between the two neighborhoods. (The biggest contributions, 2.50 each, are in the Car column — Riverton drives more than expected and Hillside less — so the difference is driven mainly by car use.)
A significant χ² says only that the four brands' distributions are not all the same somewhere in the table — it is a single overall test and never identifies which brand or which category is responsible. To find the source, the researcher should examine the individual cell contributions (O−E)²/E and compare each cell's observed vs. expected count; the cells with the largest contributions show where and how the distributions differ.
StatsIQ · Lesson 24 of 30 · Unit 3: Inference for Categorical Data: Proportions · Phase 5
This lesson aligns to the new 2026–27 AP® Statistics Course and Exam Description. AP® is a trademark registered by the College Board, which is not affiliated with and does not endorse this product.
All expected counts, χ² statistics, degrees of freedom, and p-values in this lesson were independently recomputed and verified against TI-84 χ²-Test output. Reviewed for statistical accuracy by a retired actuary.