In short
Use a chi-square test for homogeneity when you have separate samples or treatment groups and one categorical variable: H₀ says the distribution of the variable is the same in every population. Use a chi-square test for independence when you have one sample and two categorical variables: H₀ says there is no association. Both use expected counts , degrees of freedom (r − 1)(c − 1), and need all expected counts at least 5.
What you need to know
- Choose between a chi-square test for homogeneity and a test for independence.
- Write the hypotheses for each test in context.
- Calculate expected counts and degrees of freedom for a two-way table.
- Verify the conditions for a chi-square test.
Homogeneity or independence?
Both tests start from a two-way table of counts, and the arithmetic is identical. The difference is how the data were collected, which changes the hypotheses and the conclusion.
| Homogeneity | Independence | |
|---|---|---|
| Data collection | Separate random samples from two or more populations (or groups from random assignment) | One random sample, each individual classified on two variables |
| Question | Is the distribution of one variable the same in every population? | Is there an association between the two variables in the population? |
| H₀ | The distribution of [variable] is the same for all [populations] | There is no association between [variable 1] and [variable 2] |
Example: homogeneity
Independent random samples of 100 students were taken at School X and School Y and asked their preferred way to revise: flashcards, videos or written notes.
| Flashcards | Videos | Notes | Total | |
|---|---|---|---|---|
| School X | 45 | 30 | 25 | 100 |
| School Y | 30 | 40 | 30 | 100 |
| Total | 75 | 70 | 55 | 200 |
Hypotheses. H₀: the distribution of preferred revision method is the same for all students at School X and all students at School Y. Hₐ: the distributions are not the same.
Expected counts come from assuming H₀: if both schools shared the overall distribution (75/200 flashcards, and so on), School X's expected flashcards count would be 100 × 75/200 = 37.5. In general, expected = (row total × column total) ÷ table total. Here every School X and School Y row is 37.5, 35 and 27.5.
Degrees of freedom = (rows − 1)(columns − 1) = (2 − 1)(3 − 1) = 2.
Conditions
- Random: independent random samples (homogeneity) or one random sample (independence), or random assignment.
- 10%: each sample is less than 10% of its population when sampling without replacement.
- Large counts: every expected count is at least 5 (here 27.5 is the smallest).
For an independence test, the same steps apply with one sample. Example: one random sample of 300 students at a large school is classified by year (junior or senior) and plan after school (university, work, undecided). H₀: there is no association between year and plan among all students at the school; Hₐ: there is an association. Topic 3.15 carries out both tests.
Key terms
- Chi-square test for homogeneity
- Tests whether the distribution of one categorical variable is the same across several populations or treatments.
- Chi-square test for independence
- Tests whether two categorical variables measured on one sample are associated in the population.
- Expected count
- (row total × column total) ÷ table total: the count expected if H₀ were true.
- Degrees of freedom
- (number of rows − 1)(number of columns − 1) for a two-way table.
Common mistakes
Choosing the test by the shape of the table.
Choose by how the data were collected: several samples or one.
Checking that observed counts are at least 5.
The condition is on expected counts.
Writing hypotheses with proportions from the sample.
State hypotheses about the populations, in words.
How this topic is tested
- Write hypotheses in words, in context; no symbols are needed.
- Show one expected-count calculation, then list the rest.
- Name the test exactly: 'chi-square test for homogeneity' or 'for independence'.
Practice questions
Original AP-style multiple-choice questions. Pick an answer to see the explanation.
Question 1 · SP 1 · Formulate Questions
A researcher takes one random sample of 500 adults and records their age group and their favourite news source. Which test fits?
Question 2 · SP 3 · Analyze Data
In a 3 × 4 two-way table, the degrees of freedom are:
Question 3 · SP 3 · Analyze Data
Row total 120, column total 80, table total 400. The expected count for that cell is:
Question 4 · SP 1 · Formulate Questions
Three hospitals each provide a random sample of patients, classified by satisfaction (low, medium, high). The null hypothesis is:
Question 5 · SP 2 · Collect Data
Which condition must be checked before a chi-square test?
Free-response practice
Write your answer first, then mark it against the scoring guide.
Inference (set-up) · 4 points
In a randomized experiment, 90 volunteers were assigned at random to three study-break lengths (5, 15 or 30 minutes), 30 per group. Each then rated their focus as low, medium or high.
- (a) Identify the appropriate test and state hypotheses.
- (b) If 36 volunteers in total rated focus 'high', find the expected count of 'high' in the 5-minute group, and the df.
Scoring guide: one point for each of the following
Part (a)
- Chi-square test for homogeneity (three treatment groups, one categorical response).
- H₀: the distribution of focus ratings is the same for all three break lengths; Hₐ: the distributions are not all the same.
Part (b)
- Expected = 30 × 36/90 = 12.
- df = (3 − 1)(3 − 1) = 4.
Connected topics
Frequently asked questions
Is the chi-square goodness-of-fit test still in the course?
No. It was removed in the 2026 course revision; only homogeneity and independence remain.
Can a 2 × 2 table use a chi-square test?
Yes. For two groups and a yes/no variable, the chi-square test for homogeneity matches a two-sided two-proportion z-test.
Do I need symbols in the hypotheses?
No. Clear words in context are best for chi-square tests.