3.15 - Carrying Out a Chi-Square Test for Homogeneity or Independence
Overview
This topic carries out the chi-square tests set up in Topic 3.14. You compute the expected counts, the statistic, the degrees of freedom, and the -value, then interpret the -value, make a decision, and write a conclusion in context. The four steps (State, Plan, Do, Conclude) are the same as for every test in this unit.
Expected counts
The expected count in a cell is the count you'd expect if were true:
Why the formula works:
- Homogeneity: if is true, every group has the same distribution, and the best estimate of it is the table's overall column proportions. In the commuting data below, 291 of all 450 adults drive, so you'd expect of City A's 120 adults to drive: . That's (row total)(column total) / (table total).
- Independence: if the two variables are independent, . Multiply by the sample size : .
Two good habits: keep expected counts as decimals (don't round them to whole numbers), and check that each row and column of expected counts adds up to the same totals as the observed table.
The test statistic and degrees of freedom
The test statistic for a chi-square test for homogeneity or independence is
where the sum is taken over all cells of the two-way table (a table with 3 rows and 3 columns has 9 terms). Each term is called a component. When is true and the conditions are met, the statistic has (approximately) a chi-square distribution with
Count only the rows and columns of categories, not the totals. Why this df? For a table with rows and columns, once the row and column totals are fixed, only cells can be filled in freely; the totals force the rest. In a 3 by 3 table, once the 4 cells of the top-left 2 by 2 block are filled in, the totals determine every other cell.
Finding the -value
The -value is the area to the right of the observed under the chi-square curve with the right df. It's always the right tail, and it's never doubled.
- Table C: go to the row for your df, see where your falls among the critical values, and read the tail probabilities at the top of those columns. For df = 4 and : 17.58 is between 16.42 (tail probability 0.0025) and 18.47 (tail probability 0.001), so .
- TI-84, the whole test: enter the observed counts (no totals) in matrix [A] using 2nd, (MATRIX), EDIT. Then STAT, TESTS,
χ²-Test, with Observed: [A] and Expected: [B], and Calculate. It reports , the -value, and df, and it stores the expected counts in [B] so you can check the condition.
- TI-84, just the area:
χ²cdf(lower, 1E99, df).
On the exam, write the formula with the first few terms filled in, then report , df, and the -value.
Interpreting the -value
The -value is the probability of getting a statistic as large as or larger than the one observed, assuming is true. The interpretation must state that assumption in context:
Assuming [ in context], there is a [-value] probability of getting a statistic of [observed value] or larger by chance.
Making the decision and the conclusion
Compare the -value to in writing. If the -value , reject . If the -value , fail to reject .
The test's result is the statistical reasoning that answers the investigative question about the population (independence) or the populations (homogeneity). State the conclusion in context, in terms of , with non-definitive language, and name the population or populations:
- Homogeneity, reject : there is convincing evidence that the distributions of [variable] differ across [the populations].
- Independence, reject : there is convincing evidence of an association between [variable 1] and [variable 2] in [the population].
- Fail to reject : there is not convincing evidence of a difference in the distributions (or of an association). Don't write "the distributions are the same" or "the variables are independent." That's accepting .
Following up: which cells matter most
A significant chi-square test says the distributions differ (or the variables are associated), but not how. To describe the difference, look at the components. The cells with the largest components are where observed and expected counts differ the most. Then say whether each of those observed counts was above or below its expected count. AP questions often ask for exactly this.
Example 1: Commuting in three cities (AP-style)
Independent random samples of adults from three large cities (each with more than 200,000 adults) gave these counts for main way of commuting. Do the data give convincing evidence, at , that the distribution of commuting method differs among the three cities?
City | Car | Public transit | Bike or walk | Total |
City A | 78 | 30 | 12 | 120 |
City B | 84 | 48 | 18 | 150 |
City C | 129 | 24 | 27 | 180 |
Total | 291 | 102 | 57 | 450 |
State:
- : There is no difference in the distributions of main commuting method for adults in City A, City B, and City C.
- : There is a difference in the distributions of main commuting method for adults in City A, City B, and City C.
Use .
Plan: Chi-square test for homogeneity. Check the conditions:
- Randomization: independent random samples of adults from the three cities.
- 10%: each sample (120, 150, and 180 adults) is less than 10% of its city's more than 200,000 adults.
- Expected counts: all are greater than 5 (the smallest is ).
Do: Expected counts, each equal to (row total)(column total) / 450:
City | Car | Public transit | Bike or walk |
City A | 77.6 | 27.2 | 15.2 |
City B | 97.0 | 34.0 | 19.0 |
City C | 116.4 | 40.8 | 22.8 |
The nine components are:
City | Car | Public transit | Bike or walk |
City A | 0.002 | 0.288 | 0.674 |
City B | 1.742 | 5.765 | 0.053 |
City C | 1.364 | 6.918 | 0.774 |
Table C agrees: in the df = 4 row, 17.58 falls between 16.42 and 18.47, so the -value is between 0.001 and 0.0025.
Interpret the -value: Assuming the distributions of main commuting method are the same for adults in all three cities, there is about a 0.0015 probability of getting a statistic of 17.58 or larger by chance in the random sampling.
Conclude: Because the -value of 0.0015 is less than , we reject . There is convincing evidence that the distributions of main commuting method differ among adults in City A, City B, and City C.
Follow-up: The two largest components are both for public transit: City C (6.918, with 24 observed versus 40.8 expected) and City B (5.765, with 48 observed versus 34.0 expected). The biggest difference is that adults in City B use public transit more than expected and adults in City C use it less. The segmented bar chart of each city's distribution shows the same pattern.

Example 2: Grade level and clubs
A random sample of 200 of the 2,400 students at a high school gave these counts. Is there convincing evidence, at , of an association between grade level and number of clubs for students at this school?
Grade | None | One | Two or more | Total |
9 | 24 | 19 | 9 | 52 |
10 | 20 | 20 | 10 | 50 |
11 | 16 | 20 | 12 | 48 |
12 | 13 | 21 | 16 | 50 |
Total | 73 | 80 | 47 | 200 |
State:
- : There is no association between grade level and number of clubs for students at this high school.
- : There is an association between grade level and number of clubs for students at this high school.
Use .
Plan: Chi-square test for independence. Check the conditions:
- Randomization: a random sample of 200 students from the school.
- 10%: .
- Expected counts: all are greater than 5 (the smallest is ).
Do: Expected counts, each equal to (row total)(column total) / 200:
Grade | None | One | Two or more |
9 | 18.98 | 20.80 | 12.22 |
10 | 18.25 | 20.00 | 11.75 |
11 | 17.52 | 19.20 | 11.28 |
12 | 18.25 | 20.00 | 11.75 |
Table C agrees: in the df = 6 row, 6.07 is less than 7.84 (tail probability 0.25), so the -value is greater than 0.25.

Interpret the -value: Assuming there is no association between grade level and number of clubs for students at this school, there is about a 0.415 probability of getting a statistic of 6.07 or larger by chance in the random sampling.
Conclude: Because the -value of 0.415 is greater than , we fail to reject . There is not convincing evidence of an association between grade level and number of clubs for students at this high school.
The sample does show a small pattern (32% of the seniors were in two or more clubs, compared with 17% of the ninth graders), but a pattern that size could easily come from random sampling alone. That's why the conclusion says "not convincing evidence" instead of "no association."
Common mistakes
- Rounding expected counts to whole numbers. Keep the decimals.
- Wrong df: using , or counting the total row and column. Use with the category rows and columns only.
- Doubling the -value. A chi-square -value is always one right tail.
- Using proportions or percentages in the formula instead of counts.
- Accepting : writing "the variables are independent" or "the distributions are the same" after failing to reject.
- Saying the test shows which group differs. The test only says a difference exists. Use the components and the observed counts to describe it.
- Leaving "assuming is true" out of the -value interpretation.