Categorical TrendThe underlying model family class (e.g. GLM, linear model, categorical matrix, log-linear).Parametric ReferenceStatistical methods that assume a specific probability distribution family (typically normal).12-stage workflow
Mantel-Haenszel Test of Trend
Test for linear trend in proportions across ordered categories (e.g., dose-response); more powerful than chi-square when trend exists..
This test is mathematically identical to checking the significance of the linear regression slope between row and column scores.
8
Quick Example
Satisfaction \ Tier
Tier 1
Tier 2
Tier 3
Satisfied
10
15
35
Neutral
12
18
15
Dissatisfied
25
10
5
Interactive Sandbox
Mantel-Haenszel Live Laboratory
Vary the correlation strength and sample size N to watch cell concentration shift in the ordinal association grid.
Correlation coefficient (r)0.35
Sample Size (N)100
3x3 Ordinal cross-classification concentration gridPositive r concentrates cells along diagonal; negative along anti-diagonal
Calculations Output
Metric
Value
Sample Size (N)
100
Mantel-Haenszel X2 (X2_MH)
12.1275
Degrees of Freedom (df)
1
p-value
0.0005
Association Verdict
Significant Association There is a significant linear association between the two ordinal variables (p = 0.0005).
01Hypothesis test logic
Hypotheses
Pragmatic null and alternative hypotheses defined in mathematical notation.
A hypothesis is a question sharpened to a point. Ambiguity is the enemy of inference.
Logic Core
Null · H₀
H₀: No linear trend in proportions across ordered categories
Alternative · Hₐ
Hₐ: Linear trend exists (increasing or decreasing proportions)
Why it matters two-tailed (or one-tailed: increasing/decreasing)
Tests whether binary outcome proportions change linearly with ordered exposure levels. Mathematically equivalent to Cochran-Armitage trend test.
02Model diagnostics
Assumptions
The core mathematical criteria needed to ensure that statistical testing remains unbiased and valid.
Build your analysis on rock, not sand. Verify the mathematical foundation before building the model.
Integrity Shield
6
Assumptions
0
Critical / High Severity
How to check
Verify logical progression of categories. Ensure ordering reflects increasing/decreasing intensity, dose, or severity.
If violated
If categories lack natural order, use standard chi-square test of independence. If ordering unclear, consider multiple orderings in sensitivity analysis.
How to check
Plot observed proportions vs. exposure scores. Assess visual linearity. Consider polynomial contrasts or spline fits to detect non-linearity.
If violated
If non-linear: use logistic regression with polynomial terms, categorical analysis without linearity assumption, or stratified analysis.
How to check
Review study design for dependencies: longitudinal data, family clusters, geographic clustering, nested structures (patients within clinics).
If violated
For correlated data, use generalized estimating equations (GEE), mixed-effects logistic regression, or conditional logistic regression for matched data.
How to check
Calculate expected frequencies: E_ij = (n_i+ × n_+j) / n. Count cells with E_ij < 5. Check if sample is balanced across exposure levels.
If violated
Combine adjacent exposure categories, increase total sample size, use exact permutation tests, or ensure at least 10-15 observations per exposure level.
How to check
Consider whether equal spacing is reasonable. For dose-response, use actual dose values. For ordinal scales without natural metric, equal spacing may be acceptable.
If violated
Use actual exposure values when available (mg dose, years education, BMI categories' midpoints). Compare results with different scoring schemes.
How to check
Confirm outcome has exactly two categories. If outcome is ordinal (e.g., none/mild/severe), consider whether dichotomizing is appropriate.
If violated
For ordinal outcomes: use ordinal logistic regression (proportional odds model). For multinomial: use multinomial logit. For continuous: use linear regression with ordinal predictor.
03Residual Forensics
Diagnostics
Checking residual plots and indices to examine model deviations and ensure standard error integrity.
Trust, but verify. The outliers often hold more truth than the averages.
System Health
Essential checks
Plot proportions vs. ordered categories
Check for linear pattern
Calculate expected frequencies (all cells ≥5)
Examine residuals for systematic deviations from linearity
Recommended checks
Sensitivity analysis: compare results with different score assignments
Test for departure from linearity (compare MH trend vs. general chi-square)
Assess influence of extreme categories or outliers
Compare MH trend test with standard chi-square (if similar p-values, linearity assumption may not hold)
04Live Instances
Applied Minds
Review concrete study examples, data layout guidelines, and copy executable syntax scripts.
Theory is the map. Practice is the terrain. Simulation bridges the gap.
Applied Wisdom
Example 01
Air Pollution and Respiratory Disease
Epidemiological study examining whether respiratory disease prevalence increases with residential proximity to industrial pollution source. Four exposure zones based on distance.
05Tactical Pivots
Alternatives
Structured fallback pathways for choosing alternative tests when normality or slopes requirements fail.
When the path is blocked, pivot. Rigor is not rigidity; it is the intelligent adaptation to reality.
Significance is noise. Magnitude is the signal. Measure the impact, not just the probability.
Impact Magnitude
calculation
OR = exp(β) from logistic regression with score as predictor
interpretation
Multiplicative increase in odds for each unit increase in exposure score
example
OR = 1.30 per category means 30% increase in odds for each exposure level increase
recommended
Most clinically interpretable effect size
calculation
Logistic regression coefficient for score variable
interpretation
Change in log-odds per unit score increase
note
Exponentiate to obtain odds ratio
calculation
Difference in proportions: highest vs. lowest exposure category
interpretation
Percentage point increase across exposure range
clinical use
Calculate NNT (number needed to treat) = 1 / ARD
calculation
Pearson correlation between category scores and proportions
interpretation
Strength of linear relationship (r close to ±1 indicates strong trend)
limitation
Ignores sample sizes; not typically reported
Recommended Metric: Odds ratio per unit score increase
Small 0.2
Medium 0.5
Large 0.8
0.50
Odds ratio per unit score increase
Recommended Measure
4
Available Metrics
ReportUse Odds ratio per unit score increase to represent clinical impact magnitude.
08Statistical Power
Sample Size
Guidelines for minimum sample requirements and power analysis parameters.
An underpowered study is an ethical failure. Respect the data by collecting enough of it.
Power Protocol
Floor Requirements
The 'Stratified Depth' Mandate: A minimum of 10 participants per stratum (cell) is essential. Mantel-Haenszel audits trends across layers—if layers are empty, the pooled discovery basis collapses.
Effect Size
Parameters
Required n
Small Effect
OR = 1.5 (Small)
n ≈ 600 total
Medium Effect
OR = 2.5 (Medium)
n ≈ 110 total
Large Effect
OR = 4.0 (Large)
n ≈ 45 total
Key considerations
The 'Homogeneity Tax': If the trend is significant in Layer 1 but reverses in Layer 2, the Mantel-Haenszel strike will yield zero power. Audit the 'Breslow-Day' test before trusting the pooled N.
G*Power StrategyBenchmark: χ² tests → Mantel-Haenszel (Stratified Trend). Parameters: Odds Ratio (OR), Number of strata, α = .05, Power = .80. Note: Power depends on the consistency of the trend across all strata.
09APA narrative blueprint
Reporting
How to compile statistical results into publication prose matching APA and journal style guides.
Data does not speak for itself. It requires a translator. Be clear, be precise, be honest.
Narrative Arc
Worked APA paragraph example
A Mantel-Haenszel trend test was performed to assess the linear relationship between residential proximity to an industrial pollution source and respiratory disease prevalence among 800 residents across four exposure zones. Distance scores were assigned based on zone midpoints (>10km = 12.5, 5-10km = 7.5, 2-5km = 3.5, <2km = 1.0). Expected cell frequencies ranged from 37.5 to 103.1, satisfying the minimum frequency assumption. The analysis revealed a highly significant linear trend (χ²_MH = 52.18, df = 1, p < .001), with disease prevalence increasing systematically from 22.5% in the furthest zone to 57.5% in the nearest zone. Each 1-km decrease in distance from the pollution source was associated with a 1.14-fold increase in respiratory disease odds (95% CI: 1.10-1.18). The linear trend model was adequate, showing no significant departure from linearity (χ²_departure = 0.33, df = 2, p = .85). These findings demonstrate a clear dose-response gradient supporting an association between pollution exposure and respiratory disease risk.
Reusable template
A Mantel-Haenszel trend test revealed a significant linear association between exposure and outcome (χ²_MH = X.XX, df = 1, p = .XXX). The odds ratio was X.XX (95% CI: X.XX-X.XX) per unit increase in exposure score, indicating a dose-response relationship. The linear trend model was adequate, with no significant departure from linearity (χ²_departure = X.XX, df = k-2, p = .XXX).
10Exhibit Builder
Manuscript Lab
Copy standard summary tables and forensic reporting grids to outline analysis details.
Table 1: Mantel-Haenszel Chi-Square for Linear Trend
Exposure Level
Disease Rate (%)
M-H χ² (Trend)
df
p-value
Common Odds Ratio
Low
12.5%
24.52
1
< .001
2.15
Medium
28.4%
—
—
—
(per step)
High
45.2%
—
—
—
—
Note. N = 400. Stratified by Center. Exposure: Low < Med < High. Outcome: Disease (Yes/No).
p < .001Confirms 'Dose-Response'. The risk of disease is not just different between groups; it rises systematically as exposure increases.
Header glossary
The Linear Detector. Tests specifically for a linear increase (or decrease) in risk across ordinal categories, controlling for the stratification factor (Center).
The Gradient. Estimate of how much the odds of disease increase for each single-step increase in exposure level (e.g. Low to Med).
11Algorithmic Logic
Command Center
Syntax libraries and function parameters for executing calculations in stats packages.
Code is the modern laboratory. Clean execution ensures reproducible discovery.
M-H assumes the trend is consistent across all strata (Homogeneity of Odds Ratios). If the Woolf test fails, the M-H estimate is invalid because the trend depends on the stratum (Interaction).
# Execute Woolf Test for Homogeneitywoolf_test(table_data)
12The Over-adjustment Trap
Common Mistakes
Analytical caveats and corrections to maintain modeling integrity.
Wisdom is learning from the failures of others. Anticipate the error before it occurs.
Defensive Logic
Why it's wrong
Equal spacing (0,1,2,3...) assumes uniform intervals between categories, which may not reflect true exposure differences. For example, pollution zones at distances <2km, 2-5km, 5-10km, >10km have unequal spacing. Using (0,1,2,3) instead of midpoints (1, 3.5, 7.5, 12.5) distorts dose-response relationship and can attenuate effect estimates by 40-60%.
The correction
Use actual exposure values when available (dose amounts, years, concentration levels, distance in km). Example: For BMI categories 18-25, 25-30, 30-35, >35, use midpoints (21.5, 27.5, 32.5, 37.5). For truly ordinal scales without natural metric (e.g., 'mild/moderate/severe'), equal spacing is acceptable but conduct sensitivity analysis with alternative scoring schemes.
Why it's wrong
Large samples can yield highly significant p-values (p < .001) for trivial trends that lack clinical meaning. Test statistic increases with n regardless of effect magnitude. Example: OR=1.05 per category may be 'significant' with n=50,000 but represents only 5% odds increase, clinically negligible.
The correction
Always report effect sizes (OR, absolute risk difference) alongside p-values. Assess whether observed trend is clinically meaningful, not just statistically significant. Report: 'Significant trend (p<.001) with OR=1.05 per category (95% CI: 1.03-1.07), representing small but consistent effect.' Discuss clinical relevance: 'This translates to 5% increased odds per exposure level, which accumulates to 22% increase across full exposure range.'
Why it's wrong
Small expected frequencies (< 5) in sparse cells inflate Type I error rates to 8-15% (vs. nominal 5%) and compromise test validity. Chi-square approximation breaks down with sparse data, producing unreliable p-values that may falsely indicate significance.
The correction
Check ALL cells' expected frequencies: E_ij = (n_i+ × n_+j) / n. If any < 5, combine sparse adjacent categories (e.g., merge '<2km' with '2-5km' zone), increase sample size, or use exact permutation tests for small samples (coin package in R: independence_test() with distribution='exact').
Why it's wrong
Blindly applying trend test without checking whether proportions actually follow linear pattern. Non-linear trends (U-shaped, J-shaped, threshold effects, plateau) violate linearity assumption and severely reduce power (40-70% power loss). Test may miss important non-monotonic relationships.
The correction
ALWAYS plot observed proportions vs. exposure scores before analysis. Assess linearity visually (points approximate straight line?) and statistically using departure test: χ²_departure = χ²_general - χ²_trend with df = k-2. If p_departure < .05, use non-linear models (logistic regression with polynomial terms, splines, or categorical treatment without linearity constraint).
Why it's wrong
MH trend test requires ordinal exposure variable with meaningful progression. Using with nominal categories (e.g., different treatment types A, B, C with no inherent ordering, ethnic groups, geographic regions) is statistically invalid and produces uninterpretable results. The 'trend' has no meaning without order.
The correction
Confirm categories have natural ordering (never→former→current smoker, BMI categories, disease severity stages). For nominal variables with no inherent ordering, use standard chi-square test of independence (k-1 df, no trend assumption) or Fisher's exact test for small samples.
Why it's wrong
Simply stating 'significant trend exists' (p=.002) without indicating whether outcome increases or decreases with exposure, or quantifying strength, provides no actionable information for clinical or policy decisions. Readers cannot assess practical relevance or compare across studies.
The correction
Report direction (positive/negative/increasing/decreasing trend), magnitude (OR with 95% CI), and substantive interpretation. Example: 'Respiratory disease prevalence increased significantly with residential proximity to pollution (χ²_MH=52.2, p<.001). OR=1.14 per km closer (95% CI: 1.10-1.18), meaning 14% higher odds for each kilometer closer to source, accumulating to 2.8-fold increase from furthest (>10km) to nearest (<2km) zone.'
Why it's wrong
Observed trends may reflect confounding variables (age, SES, comorbidities, lifestyle factors) rather than causal exposure effects. MH trend test does not adjust for covariates. Example: proximity-disease association may be confounded by SES if poorer neighborhoods are closer to pollution sources.
The correction
Use multivariable logistic regression to adjust for identified confounders: glm(outcome ~ exposure_score + age + sex + SES + comorbidities, family=binomial). MH test is appropriate for unadjusted bivariate screening, but adjusted analysis required for causal inference. Report both unadjusted and adjusted estimates: 'Unadjusted OR=1.14 (p<.001); adjusted OR=1.09 (p=.002) after controlling for age, sex, and SES, suggesting partial but not complete confounding.'
Why it's wrong
Mantel-Haenszel name applies to two different tests: (1) MH trend test (linear association in 2×k table, this test), and (2) MH stratified test (common odds ratio across strata, different test). Confusion leads to incorrect application and interpretation, especially regarding stratification vs. trend analysis.
The correction
Clarify which MH test you're using. MH TREND test: tests linear association between ordered exposure and binary outcome (unstratified, 1 df). MH STRATIFIED test: estimates common OR across multiple strata adjusting for confounding (Mantel-Haenszel common OR). If you need to test trend WHILE controlling for strata, use Cochran-Mantel-Haenszel test or stratified logistic regression.
13Academic Lineage
References
Scholarly lineage and citation keys grounding the statistical framework.
We stand on the shoulders of giants. Honor the source of the method.
Academic Lineage
[1]
[2]
[3]
[4]
[5]
14Model Ecosystem
Related Tests
Bridges to simpler, more complex, non-parametric, or alternative versions.
No model exists in isolation. Understanding the family tree reveals the true nature of the test.
Model Ecosystem
cochran armitage trend
Mathematically identical; different historical origins but same test statistic
chi square independence
More general test not assuming trend; use when linearity questionable
logistic regression
Extends trend test; allows covariate adjustment and non-linear modeling
jonckheere terpstra
Non-parametric alternative for ordered alternatives