What Is the Chi-Square Test of Homogeneity?
The Pearson chi-square test of homogeneity asks whether a categorical outcome has the same distribution across two or more independent groups. You have an r × c table — one row per group, one column per category — and the test compares the observed counts in each cell with the counts expected if the category proportions were identical in every group. It is a test of difference between group profiles, not of association between two variables in one population.
When to Use It
Use it when observations come from separate, independent groups (treatment arms, regions, cohorts) and the outcome is a categorical variable with two or more levels. Typical examples: improvement rates across three drug arms, product preference across geographic regions, or defect type across production lines.
Do not use it when observations are paired or matched, when the outcome is continuous, or when expected counts are very small.
Formula and Expected Frequencies
Expected count under the null of identical distributions: Eᵢⱼ = (Row totalᵢ × Column totalⱼ) / N.
Pearson chi-square statistic: χ² = Σ (Oᵢⱼ − Eᵢⱼ)² / Eᵢⱼ, summed over every cell.
Degrees of freedom: df = (r − 1)(c − 1). A 2×2 table has df = 1; a 3×3 table has df = 4.
The p-value is the upper-tail probability P(X² ≥ χ²) under the chi-square distribution with df degrees of freedom, assuming the null hypothesis is true. The critical value χ²crit is the threshold at which that probability equals α. Reject the null if p < α, or equivalently if χ² > χ²crit — both rules give the same answer.
Cramér's V and Residuals
Cramér's V measures the strength of the difference between group distributions on a roughly 0-to-1 scale: V = √(χ² / (N × min(r − 1, c − 1))). For 2×2 tables, Phi = √(χ² / N) equals Cramér's V. A significant p-value does not imply a large V — with a large N, a trivial difference can be statistically significant.
The standardized (Pearson) residual for a cell is (O − E) / √E. It shows how far a cell's observed count sits from the expected count, in units of standard deviations under the null. Cells with |residual| around 2 or higher are often flagged as contributing disproportionately to the difference and are the natural place to look when interpreting a significant result.
Assumptions and Expected-Count Warnings
- Independent observations. Each observation falls into exactly one cell, and the groups are independent samples.
- Mutually exclusive and exhaustive categories. Every observation belongs to one and only one row and one and only one column.
- Counts, not percentages. The formula requires actual frequencies.
- Sufficient expected counts. A common rule of thumb is at least 5 in most cells.
The calculator flags two situations. If any expected count is below 5, the chi-square approximation may be unreliable — consider combining sparse categories if scientifically defensible. If the table is 2×2 with any expected count below 5, Fisher's Exact Test is often preferable to the asymptotic chi-square.
Yates Continuity Correction
For 2×2 tables only, Yates correction reduces each |O − E| by 0.5 before squaring: (|O − E| − 0.5)² / E. It is optional and conservative — it reduces χ² and increases the p-value. Modern practice often prefers Fisher's Exact Test for sparse 2×2 tables instead. When Yates is enabled, the uncorrected Pearson χ² is still shown in the calculation steps.
Worked Example
Three treatment groups (Drug A, Drug B, Placebo) with three outcome categories (Improved, No change, Worsened). Observed counts:
- Drug A: 45 / 30 / 15
- Drug B: 40 / 35 / 15
- Placebo: 20 / 40 / 30
N = 270. Expected counts under homogeneity are computed from row and column totals. The Pearson contributions sum to χ² ≈ 18.93 with df = 4. The upper-tail p-value is < .001, and Cramér's V ≈ 0.19 — a small-to-moderate difference. The largest standardized residuals sit in the Placebo row, where fewer patients improved and more worsened than expected if all three groups had the same outcome distribution.
How to Interpret and Report
A significant result means the group distributions are not the same — it does not identify which groups differ. Inspect the standardized residuals to see where the departure from homogeneity is concentrated. A non-significant result means the data are consistent with identical distributions, but it is not proof that the distributions are identical.
APA-style: χ²(4, N = 270) = 18.93, p < .001, Cramér's V = .19. Report the design (independent groups, categorical outcome), the table dimensions, the omnibus result, the effect size, and any cells with large residuals that drive the result.
Homogeneity vs Independence vs Goodness-of-Fit
All three use the Pearson chi-square statistic with the same formula. What differs is the sampling design and the question.
- Homogeneity — one categorical variable, two or more independent groups; asks whether the category distribution is the same across groups.
- Independence — one sample, two categorical variables; asks whether the two variables are associated.
- Goodness-of-fit — one sample, one categorical variable, one hypothesized distribution; asks whether the observed proportions match the hypothesis.
Homogeneity and independence share the same arithmetic and df because the design distinction does not change the math — it changes how you describe the study and how you sample.
Common Mistakes
- Entering percentages instead of counts.
- Treating a significant result as proof that every group differs from every other group — it only says at least one does.
- Reading p > α as proof of identical distributions.
- Ignoring the expected-count warnings.
- Using this test for paired or matched data.
- Reporting p without Cramér's V.