StatisticsInferential Statistics

Knowledge guide

How to Use a Chi-Square Test for Homogeneity

Learn when a chi-square test for homogeneity applies, how to calculate expected counts, and how to state a conclusion without overclaiming.

What the test asks

A chi-square test for homogeneity asks whether two or more populations have the same distribution across the categories of one response variable. Typical comparisons include two campuses, several age groups, or measurements taken before and after an event.

This differs from a chi-square goodness-of-fit test. Goodness of fit compares one observed distribution with a specified set of proportions; homogeneity compares distributions across populations or groups.

The hypotheses

For r groups and c response categories:

  • H₀: The categorical response has the same distribution in every group.
  • Hₐ: At least one group has a different distribution.

The alternative does not say which cells differ. A significant result establishes a distributional difference, but further analysis is needed to identify its pattern.

Expected counts and the test statistic

For the cell in row i and column j, calculate

Eᵢⱼ = (row i total × column j total) / grand total.

Then sum the standardized discrepancies:

χ² = Σ((Oᵢⱼ − Eᵢⱼ)² / Eᵢⱼ).

Large discrepancies make χ² large and provide evidence against H₀. The degrees of freedom are

df = (r − 1)(c − 1).

A fresh example

Suppose two campuses each survey 100 students about a preferred study format.

CampusSoloSmall groupWorkshop
North503020
South303040

The column totals are 80, 60, and 60, and the grand total is 200. Because each row total is 100, the expected counts in each row under H₀ are 40, 30, 30.

The test statistic is

χ² = (50−40)²/40 + (30−30)²/30 + (20−30)²/30

+ (30−40)²/40 + (30−30)²/30 + (40−30)²/30

= 11.667.

Here df = (2−1)(3−1) = 2, giving p ≈ 0.0029. At α = 0.05, reject H₀: the data provide evidence that preferred study-format distributions differ between the two campuses.

Conditions and interpretation checks

Before using the approximation, verify that observations are independent and expected cell counts are sufficiently large; a common classroom rule is that each expected count should be at least 5.

Use careful conclusion language:

  • If p ≤ α, reject H₀ and report evidence of different distributions.
  • If p > α, fail to reject H₀; do not claim that the distributions have been proved identical.

Common mistakes are using observed counts in place of expected counts, using c − 1 when more than two rows are present, and treating a nonsignificant result as proof of equality.

Related question

Apply this knowledge

Use the concept guide to understand the reasoning, then return to the complete question and worked answer.

The Frequency Table Shows the Results of a Survey: Did Voter Preferences Change?

Sources

These references support the core concepts and interpretation boundaries explained above.