Method document
Sample size for a common odds ratio across strata (Cochran–Mantel–Haenszel)
How many cases and controls are needed when they are compared within strata, such as centres, age bands or sexes, and one odds ratio is assumed to hold in every stratum. Each stratum has its own exposure among controls, its own share of the sample and its own balance of cases and controls; the analysis is the Cochran–Mantel–Haenszel test.
https://statwisely.com/methods/odds-ratio-cmh/
When to use it
- A case-control study analysed with the Cochran–Mantel–Haenszel test, stratified by a confounder or by recruiting centre.
- Any comparison of a binary outcome between two groups within strata, such as a multi-centre trial analysed by centre.
Not for
- Odds ratios that differ markedly between strata. The test assumes a common odds ratio; check for heterogeneity, for example with the Breslow–Day test, and report strata separately if it is present.
- Individually matched case-control studies, which need a conditional analysis.
- Adjusting for several confounders at once, or for a continuous one. Use logistic regression.
Notation
- Total number of cases and controls
- Common odds ratio
- Exposure among cases and among controls in stratum i
- Stratum i’s share of the sample
- Share of cases within stratum i
- Exposure in stratum i, cases and controls combined
- Significance level: the chance of a false positive
- Power: the chance of detecting the effect if it is real
- Number of tails: 2 for a two-sided test, 1 for one-sided
- Expected dropout
Formulas
Exposure among cases in each stratum
The same odds ratio in every stratum implies a different exposure among cases wherever exposure among controls differs.
Total needed
The CMH statistic [2] adds the difference between observed and expected exposed cases over the strata. Its variance under no association gives X, and under the odds ratio gives Y [1].
With the continuity correction
For the corrected test, the default in R’s mantelhaen.test. Each stratum’s cases, ⌈N t_i s_i⌉, and controls, ⌈N t_i (1 − s_i)⌉, are then rounded up separately.
Parameters
Common odds ratio
Values: Above 0, not 1
The smallest odds ratio worth detecting, assumed the same in every stratum.
Exposure among controls, by stratum
Values: Between 0 and 1, one per stratum
From population surveys or earlier studies, stratum by stratum. Strata where exposure is very rare or very common contribute little.
Share of the sample in each stratumOptional
Values: Positive, adding up to 1; equal if omitted
How recruitment is expected to split over the strata, for example by each centre’s caseload.
Share of cases within each stratumOptional
Values: Between 0 and 1; 0.5 if omitted
0.5 means as many controls as cases. Where controls are frequency-matched to cases, this is the share of cases.
Continuity correctionOptional
Values: On or off; on by default
Match the analysis: leave it on if the corrected test will be reported.
Significance level
Values: Between 0 and 1; usually 0.05
The false-positive rate you accept. A smaller α, for example to allow for several primary outcomes, needs a larger sample.
Power
Values: Between 0 and 1; usually 0.80 or 0.90
The chance of a significant result if the assumed effect is real. Funders and ethics committees commonly expect at least 0.80.
One- or two-sided
Values: 2 (two-sided) or 1 (one-sided)
Two-sided is the default. A one-sided test is justified only when an effect in the other direction would be treated exactly as no effect, and should be stated in advance.
Expected dropoutOptional
Values: 0% up to, but not including, 100%
The share of participants expected to provide no outcome, from comparable studies. Recruiting more restores the numbers, not the comparability of the groups: if dropout is related to the outcome, the estimate can still be biased.
Assumptions
- The odds ratio is the same in every stratum.
- Within each stratum, cases and controls are independent samples, and controls represent the population the cases arose from.
- The normal approximation to the CMH statistic holds, which needs enough participants in every stratum; with very small strata, check the power by simulation.
- Dropout is unrelated to the outcome; recruiting more participants restores the numbers but cannot remove bias.
Worked examples
Three age bands
An odds ratio of 2, with 20%, 30% and 40% of controls exposed in age bands making up 50%, 30% and 20% of the sample, as many cases as controls; α = 0.05, 80% power, two-sided, continuity corrected: N = 331.1, so 167 cases and 167 controls, rounded up stratum by stratum.
Cases: 167 · Controls: 167 · Total: 334
Open this example in the calculatorProtocol statement
To detect a common odds ratio of 0 with 80% power at a two-sided significance level of 0.05, using a Cochran–Mantel–Haenszel test of a common odds ratio across strata, and assuming 0 strata with exposure in of controls, making up of the sample and a continuity correction, the required sample size is 167 cases and 167 controls (334 in total). Calculated with StatWisely (statwisely.com) using: N = [z_α√X + z_β√Y]²/Z², X = Σ t s(1-s) p̄(1-p̄), Y = Σ t s(1-s)[(1-s)p₁(1-p₁) + s p₂(1-p₂)], Z = Σ t s(1-s)(p₁-p₂); continuity corrected: N/4 × [1 + √(1 + 2/(|Z|N))]². These are planning estimates; confirm the final design with a qualified statistician.
Without the continuity correction
The same design analysed without the correction: N = 304.9, so 154 cases and 154 controls.
Cases: 154 · Controls: 154 · Total: 308
Open this example in the calculatorFewer cases in the older bands
Cases making up 50%, 40% and 30% of the three bands: 150 cases and 199 controls. An unbalanced stratum carries less information, so the total rises.
Cases: 150 · Controls: 199 · Total: 349
Open this example in the calculatorA one-sided test
Testing only for a raised odds ratio: 134 cases and 134 controls.
Cases: 134 · Controls: 134 · Total: 268
Open this example in the calculatorAllowing for incomplete data
Expecting 10% to have no usable exposure data: 167 / 0.9 = 185.6, so 186 cases and 186 controls are recruited.
Cases: 167 · Controls: 167 · Total: 334 · To recruit: 186 and 186
Open this example in the calculatorProtocol statement
To detect a common odds ratio of 0 with 80% power at a two-sided significance level of 0.05, using a Cochran–Mantel–Haenszel test of a common odds ratio across strata, and assuming 0 strata with exposure in of controls, making up of the sample and a continuity correction, the required sample size is 167 cases and 167 controls (334 in total). Allowing for 0% dropout, 186 cases and 186 controls (372 in total) should be recruited. Calculated with StatWisely (statwisely.com) using: N = [z_α√X + z_β√Y]²/Z², X = Σ t s(1-s) p̄(1-p̄), Y = Σ t s(1-s)[(1-s)p₁(1-p₁) + s p₂(1-p₂)], Z = Σ t s(1-s)(p₁-p₂); continuity corrected: N/4 × [1 + √(1 + 2/(|Z|N))]². These are planning estimates; confirm the final design with a qualified statistician.
Validation
- Every worked example on this page is recomputed by the StatWisely engine whenever the software is built. If a number or formula here stopped matching the calculator, the release would be stopped until this document was corrected.
- An independent implementation in R recomputes this test every night and before each production release, and the results are compared with the engine’s.
- The worked examples agree exactly with the R package samplesizeCMH, which implements the same method, and a simulation of mantelhaen.test confirms the power the plan promises.
How to cite
StatWisely. Sample size for a common odds ratio across strata (Cochran–Mantel–Haenszel). Method document, engine version 1.0.0, reviewed 2026-10-09. https://statwisely.com/methods/odds-ratio-cmh/
Cite the original references for the formulas your design uses as well.
References
- 1.Woolson RF, Bean JA, Rojas PB. Sample size for case-control studies using Cochran’s statistic. Biometrics. 1986;42(4):927–932. doi:10.2307/2531207
- 2.Mantel N, Haenszel W. Statistical aspects of the analysis of data from retrospective studies of disease. Journal of the National Cancer Institute. 1959;22(4):719–748. doi:10.1093/jnci/22.4.719