Signature
N_1 = n1_1 + n2_1; N_2 = n1_2 + n2_2; R_RR = a_1 * n2_1 / N_1 + a_2 * n2_2 / N_2; S_RR = c_1 * n1_1 / N_1 + c_2 * n1_2 / N_2; P = (n1_1 * n2_1 * (a_1 + c_1) - a_1 * c_1 * N_1) / N_1^2 + (n1_2 * n2_2 * (a_2 + c_2) - a_2 * c_2 * N_2) / N_2^2; RR_MH = R_RR / S_RR; lnRR_MH = log(RR_MH); SE_lnRR = sqrt(P / (R_RR * S_RR)); RR_L = exp(lnRR_MH - 1.96 * SE_lnRR); RR_U = exp(lnRR_MH + 1.96 * SE_lnRR)
| Inputs | Definition | Unit |
|---|---|---|
n1_1 | Patients in the new treatment arm of trial or stratum 1, above 0 | count |
n2_1 | Patients in the comparator arm of trial or stratum 1, above 0 | count |
n1_2 | Patients in the new treatment arm of trial or stratum 2, above 0 | count |
n2_2 | Patients in the comparator arm of trial or stratum 2, above 0 | count |
a_1 | Events in the new treatment arm of trial or stratum 1, at least 0 and at most the arm size | count |
a_2 | Events in the new treatment arm of trial or stratum 2, at least 0 and at most the arm size | count |
c_1 | Events in the comparator arm of trial or stratum 1, at least 0 and at most the arm size | count |
c_2 | Events in the comparator arm of trial or stratum 2, at least 0 and at most the arm size | count |
N_1 | Patients in trial or stratum 1 | count |
|---|---|---|
N_2 | Patients in trial or stratum 2 | count |
R_RR | Sum over strata of a n2 / N; must exceed 0 for the log and the standard error | weighted count |
S_RR | Sum over strata of c n1 / N, which is also the sum of the risk ratio weights; must exceed 0 | weighted count |
P | Sum over strata of (n1 n2 (a + c) minus a c N) / N squared | weighted count |
RR_MH | Pooled risk of the event on the new treatment relative to the comparator | ratio, no unit |
lnRR_MH | Natural log of RR_MH | log risk ratio |
SE_lnRR | Standard error of lnRR_MH | log risk ratio |
RR_L | Lower limit of the 95% confidence interval for RR_MH | ratio, no unit |
RR_U | Upper limit of the 95% confidence interval for RR_MH | ratio, no unit |
Function
Mantel-Haenszel pooling and test of association across stratified two-by-two tables
Maps the cell counts of several two-by-two tables, one per trial or stratum, to a pooled odds ratio, risk ratio or risk difference with its standard error, and to a test of association, while keeping each comparison inside its own stratum. HE-FM-MHM-001 to HE-FM-MHM-003 give the estimators and HE-FM-MHM-004 the Cochran-Mantel-Haenszel statistic, each written out for two strata so that the calculator runs. Their Excel rows take any number of strata, and HE-CF-MHM-001 chains all four for three trials. Another common-effect weighting is the inverse-variance estimate HE-FM-ADMA-001, which HE-FM-PWMA-001 feeds for a risk ratio. The risk difference of one trial is HE-FM-ARR-001 with the sign reversed. Applying a pooled ratio to a baseline probability takes the form of HE-FM-NMA-004 for an odds ratio, written there for a network odds ratio, and is HE-FM-ARR-002 for a risk ratio. Notation follows the Mantel-Haenszel Method article.
Try this function
Implementations
Excel
Excel Mantel-Haenszel risk ratio from one row per stratum
With one row per stratum and equal-length ranges named TrialEventsNew, TrialSizeNew, TrialEventsComparator and TrialSizeComparator, the formulas go in order into RiskNumeratorMH, RiskDenominatorMH, RiskVarianceSumMH, PooledRiskRatioMH, LogPooledRiskRatioMH, StandardErrorLogRiskRatioMH, RiskRatioLowerLimitMH and RiskRatioUpperLimitMH. A row left blank has both sizes treated as 0 and returns #DIV/0!. RiskDenominatorMH equal to 0 also returns #DIV/0!, and RiskNumeratorMH equal to 0 returns a pooled value of 0 with #NUM! in the log.
=SUMPRODUCT(TrialEventsNew*TrialSizeComparator/(TrialSizeNew+TrialSizeComparator)); =SUMPRODUCT(TrialEventsComparator*TrialSizeNew/(TrialSizeNew+TrialSizeComparator)); =SUMPRODUCT((TrialSizeNew*TrialSizeComparator*(TrialEventsNew+TrialEventsComparator)-TrialEventsNew*TrialEventsComparator*(TrialSizeNew+TrialSizeComparator))/(TrialSizeNew+TrialSizeComparator)^2); =RiskNumeratorMH/RiskDenominatorMH; =LN(PooledRiskRatioMH); =SQRT(RiskVarianceSumMH/(RiskNumeratorMH*RiskDenominatorMH)); =EXP(LogPooledRiskRatioMH-1.96*StandardErrorLogRiskRatioMH); =EXP(LogPooledRiskRatioMH+1.96*StandardErrorLogRiskRatioMH)
Assumptions
Stratified counts with both pooled sums above zero for the Mantel-Haenszel risk ratio
Each patient appears in one table and both arms of each stratum hold patients. An event count of zero in one arm of one stratum needs no correction as long as R_RR and S_RR stay above 0. A trial with no events in either arm adds nothing to R_RR, S_RR or P, so it drops out (derived).
One risk ratio common to all strata in the Mantel-Haenszel pooled estimate
One effect is assumed common to all studies on the risk ratio scale. Greenland and Robins show that under a binomial sparse-data model the estimator is consistent in sparse stratifications while maximum likelihood and weighted least squares estimators are biased, and that variance estimators consistent in both sparse data and large strata can be derived. A common risk ratio and a common odds ratio are different assumptions, so the choice of scale needs justifying.
Worked examples
Mantel-Haenszel risk ratio of the article's two illustrative trials
With the article's illustrative trials, R_RR is 10 + 26.667 and S_RR is 15 + 33.333, so the pooled risk ratio is 36.667 / 48.333 = 0.759, with a 95% interval of 0.601 to 0.958, as in the article. Trial values are 0.667 and 0.800, and the collapsed table would give 0.833.
a_1 = 20; n1_1 = 100; c_1 = 30; n2_1 = 100; a_2 = 80; n1_2 = 200; c_2 = 50; n2_2 = 100; N_1 = 200; N_2 = 300; R_RR = 36.6667; S_RR = 48.3333; P = 25.0556; RR_MH = 0.7586; lnRR_MH = -0.2763; SE_lnRR = 0.1189; RR_L = 0.6009; RR_U = 0.9577
Limiting case of two identical tables for the Mantel-Haenszel risk ratio
Two illustrative trials, each with the counts of trial A, return its risk ratio of 0.6667. Its standard error is the square root of half of the HE-FM-PWMA-001 variance of 0.0633, or 0.1780 (derived). The case is illustrative and checks an implementation.
a_1 = 20; n1_1 = 100; c_1 = 30; n2_1 = 100; a_2 = 20; n1_2 = 100; c_2 = 30; n2_2 = 100; N_1 = 200; N_2 = 200; R_RR = 20; S_RR = 30; P = 19; RR_MH = 0.6667; lnRR_MH = -0.4055; SE_lnRR = 0.178; RR_L = 0.4704; RR_U = 0.9449
Common errors
Swapping the arm sizes in the Mantel-Haenszel risk ratio
Each event count is multiplied by the size of the other arm. Using a n1 / N and c n2 / N instead returns 2.0 in the article's example when the correct value is 0.759. A 1 to 1 trial hides the mistake, because its arm sizes are equal, so it shows only once allocation is unequal (derived).
Taking the reciprocal to get a Mantel-Haenszel risk ratio for the absence of the event
A risk ratio for no event is computed on the non-event counts. In the article's example the pooled risk ratio of no admission is 1.171, whereas the reciprocal of the pooled risk ratio of admission is 1.318 (derived). Swapping the two arms does give the reciprocal, because R_RR and S_RR change places (derived).
Sources
RevMan statistical algorithms for the Mantel-Haenszel risk ratio and its standard error
Deeks JJ, Higgins JPT. Statistical algorithms in Review Manager. Cochrane Statistical Methods Group; May 2022. Section Mantel-Haenszel methods for combining results across studies, subsection Risk ratio. Equation 3 gives the summary log risk ratio as the log of a weighted average of study risk ratios, the unnumbered line after it gives the summary risk ratio as that average, with weight c (a + b) / N, and equation 4 gives the standard error of the log summary as the square root of P / (R S), with P, R and S as printed.
Greenland and Robins on common effect estimation from sparse follow-up data
Greenland S, Robins JM. Estimation of a common effect parameter from sparse follow-up data. Biometrics. 1985;41(1):55-68. The abstract states that under a binomial sparse-data model the Mantel-Haenszel risk ratio and risk difference estimators are consistent in sparse stratifications while maximum likelihood and weighted least squares estimators are biased, cites Breslow for the odds ratio, and states that variance estimators consistent in both sparse data and large strata can be derived for all the Mantel-Haenszel estimators.
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0
