Mantel-Haenszel pooling and test of association across stratified two-by-two tables
mh(a_i, b_i, c_i, d_i) = (OR_MH, RR_MH, RD_MH, chi2_MH)
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.
Mantel-Haenszel pooled odds ratio with its Robins, Breslow and Greenland standard error
N_1 = a_1 + b_1 + c_1 + d_1; N_2 = a_2 + b_2 + c_2 + d_2; R = a_1 * d_1 / N_1 + a_2 * d_2 / N_2; S = b_1 * c_1 / N_1 + b_2 * c_2 / N_2; E = (a_1 + d_1) * a_1 * d_1 / N_1^2 + (a_2 + d_2) * a_2 * d_2 / N_2^2; F = (a_1 + d_1) * b_1 * c_1 / N_1^2 + (a_2 + d_2) * b_2 * c_2 / N_2^2; G = (b_1 + c_1) * a_1 * d_1 / N_1^2 + (b_2 + c_2) * a_2 * d_2 / N_2^2; H = (b_1 + c_1) * b_1 * c_1 / N_1^2 + (b_2 + c_2) * b_2 * c_2 / N_2^2; OR_MH = R / S; lnOR_MH = log(OR_MH); SE_lnOR = sqrt(0.5 * (E / R^2 + (F + G) / (R * S) + H / S^2)); OR_L = exp(lnOR_MH - 1.96 * SE_lnOR); OR_U = exp(lnOR_MH + 1.96 * SE_lnOR)
Mantel-Haenszel pooled risk ratio with its standard error
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)
Mantel-Haenszel pooled risk difference with its standard error
N_1 = n1_1 + n2_1; N_2 = n1_2 + n2_2; RD_1 = a_1 / n1_1 - c_1 / n2_1; RD_2 = a_2 / n1_2 - c_2 / n2_2; w_1 = n1_1 * n2_1 / N_1; w_2 = n1_2 * n2_2 / N_2; K = w_1 + w_2; J = (a_1 * (n1_1 - a_1) * n2_1^3 + c_1 * (n2_1 - c_1) * n1_1^3) / (n1_1 * n2_1 * N_1^2) + (a_2 * (n1_2 - a_2) * n2_2^3 + c_2 * (n2_2 - c_2) * n1_2^3) / (n1_2 * n2_2 * N_2^2); RD_MH = (w_1 * RD_1 + w_2 * RD_2) / K; SE_RD = sqrt(J / K^2); RD_L = RD_MH - 1.96 * SE_RD; RD_U = RD_MH + 1.96 * SE_RD
Cochran-Mantel-Haenszel test statistic for stratified two-by-two tables
N_1 = n1_1 + n2_1; N_2 = n1_2 + n2_2; M_1 = a_1 + c_1; M_2 = a_2 + c_2; E_1 = n1_1 * M_1 / N_1; E_2 = n1_2 * M_2 / N_2; V_1 = n1_1 * n2_1 * M_1 * (N_1 - M_1) / (N_1^2 * (N_1 - 1)); V_2 = n1_2 * n2_2 * M_2 * (N_2 - M_2) / (N_2^2 * (N_2 - 1)); D_MH = (a_1 - E_1) + (a_2 - E_2); V_MH = V_1 + V_2; chi2_MH = D_MH^2 / V_MH
