Chi-Square Test for Independence and Homogeneity
Test for an association between two categorical variables using a two-way table. Compute expected counts E = (row total × column total)/n and χ² with df = (r−1)(c−1). Distinguish tests of independence from tests of homogeneity.
A lesson of AP Statistics, in Inference for Categorical Data: Proportions, about 10 minutes.
By the end of this lesson, you will be able to conduct chi-square tests for independence and homogeneity, calculate expected counts from a two-way table, and correctly interpret results.
Two Types of Chi-Square Tests for Two-Way Tables
Test for Independence: Tests whether two categorical variables are associated within a single population.
- Example: Is political party affiliation associated with opinion on climate change?
Test for Homogeneity: Tests whether two or more populations have the same distribution of a categorical variable.
- Example: Do male and female students have the same distribution of class choices?
Mechanically: These tests are conducted identically — same formula, same procedure. The distinction matters for interpretation and design, not calculation.
Setup: Two-Way Contingency Table
Data is organized in a table with r rows and c columns.
Example — Independence: Is there an association between exercise frequency and health rating?
| Excellent | Good | Fair | Total | |
|---|---|---|---|---|
| Daily exercise | 45 | 30 | 10 | 85 |
| Occasional | 20 | 40 | 25 | 85 |
| Rarely | 10 | 25 | 45 | 80 |
| Total | 75 | 95 | 80 | 250 |
Hypotheses
Test for Independence:
- H₀: The two variables are independent (not associated) in the population
- Hₐ: The two variables are associated in the population
Test for Homogeneity:
- H₀: The distribution of the categorical variable is the same across all populations
- Hₐ: At least one population has a different distribution