Mantel–Haenszel Test for Ordinal
Association (r×k table)
The Mantel–Haenszel test for ordinal association (sometimes called the Mantel test for
trend or Cochran–Mantel–Haenszel test for linear association) is a statistical method used
when you have a contingency table with ordered categories (usually a 2×k or r×k table,
where one or both variables are ordinal). It’s designed to test whether there is a linear
(monotonic) association between the row and column variables.
Key Idea
Instead of just testing independence (like the Pearson chi-square test), the Mantel–Haenszel
test incorporates the ordering of categories. It assigns numerical scores to the ordered
categories and then tests whether row and column scores are linearly related.
1. Setup
You have an r×k contingency table:
| Row
| Col 1| Col 2| … | Col k | Row total |
|--------------------|-------|-------|---|-------|-----------|
|1
| n₁₁ | n₁₂ | … | n₁ₖ | n₁·
|
|2
| n₂₁ | n₂₂ | … | n₂ₖ | n₂·
|
|…
|… |… |…|… |…
|
|r
| nᵣ₁ | nᵣ₂ | … | nᵣₖ | nᵣ·
|
| Column totals | n·₁ | n·₂ | … | n·ₖ | N
|
Both rows and columns are ordinal. We want to test for a linear association (trend).
2. Assign Scores
• Assign scores uⱼ to the row categories (j=1,…,r).
• Assign scores vₖ to the column categories (k=1,…,k).
Default: uⱼ = j, vₖ = k, but custom spacing can be used.
3. Compute Correlation-like Statistic
Mean row score:
ū = (1/N) Σⱼₖ uⱼ nⱼₖ
Mean column score:
v̄ = (1/N) Σⱼₖ vₖ nⱼₖ
Numerator (covariance between row and column scores):
Q = Σⱼₖ (uⱼ - ū)(vₖ - v̄ ) nⱼₖ
Denominators (variances):
Sᵤ² = Σⱼₖ (uⱼ - ū)² nⱼₖ
Sᵥ² = Σⱼₖ (vₖ - v̄ )² nⱼₖ
4. Test Statistic
Mantel–Haenszel chi-square:
χ²MH = Q² / (Sᵤ² Sᵥ² / N)
This follows a chi-square distribution with 1 degree of freedom.
5. Interpretation
• Large χ²MH → evidence of monotonic association between row and column variables.
• Small χ²MH → no evidence of ordered relationship.
• More powerful than a general chi-square test of independence when the ordering
assumption is valid.
The classic Mantel–Haenszel test is used for 2×2 tables, stratified by a third variable, to test
for an overall association (conditional independence) while controlling for stratification.