Method document
Sample size to detect an odds ratio
How many cases and controls are needed to show that an exposure is associated with an outcome, from the expected exposure among controls and either the exposure among cases or the odds ratio. Covers unequal numbers of controls per case and dropout.
https://statwisely.com/methods/odds-ratio/
When to use it
- An unmatched case-control study testing whether an exposure is more, or less, common among cases.
Not for
- Matched case-control studies, which need a conditional analysis and its own calculation.
- Comparisons made within strata, such as centres or age bands, with one odds ratio common to them. Use the stratified (Cochran–Mantel–Haenszel) tab.
- Estimating the odds ratio to a stated precision. Use the odds ratio under “Estimate precisely”.
- Odds ratios adjusted for other variables. Use logistic regression.
Notation
- Number of cases
- Controls per case
- Expected exposure among cases and among controls
- Exposure in the two groups combined
- Odds ratio
- Significance level: the chance of a false positive
- Power: the chance of detecting the effect if it is real
- Expected dropout
Formulas
Exposure among cases from the odds ratio
When the odds ratio is given rather than p₁, this is the exposure among cases it implies.
Cases needed
Detecting an odds ratio different from 1 is detecting a difference in exposure between cases and controls, so the calculation is the comparison of two proportions [1, 2]. Controls are ⌈r_a n⌉; the test is two-sided.
Dropout
Applied last, to the participants actually recruited.
Parameters
Exposure among controls
Values: Between 0 and 1
Often known from population surveys, since controls represent the population the cases arose from.
Exposure among casesOptional
Values: Between 0 and 1
Give this or the odds ratio.
Odds ratio to detectOptional
Values: Above 0, not 1
The smallest odds ratio worth detecting, instead of p₁.
Controls per caseOptional
Values: Above 0; 1 for equal numbers
When cases are scarce, recruiting 2 to 4 controls per case reduces the cases needed; beyond about 4 there is little further gain.
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.
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
- Cases and controls are independent, unmatched samples, and controls represent the population the cases arose from.
- The analysis is a crude comparison; adjustment for confounders needs more participants.
- Dropout is unrelated to the outcome; recruiting more participants restores the numbers but cannot remove bias.
Worked examples
From the two exposures
Exposure expected in 0.4 of cases and 0.2 of controls, an odds ratio of 2.67; α = 0.05, 80% power: 82 cases and 82 controls.
Cases: 82 · Controls: 82 · Total: 164
Open this example in the calculatorProtocol statement
To detect an odds ratio of 2.667 with 80% power at a two-sided significance level of 0.05, using a comparison of exposure between cases and controls, and assuming exposure in 20% of controls, the required sample size is 82 cases and 82 controls (164 in total). Calculated with StatWisely (statwisely.com) using: n₁ = [z_(1-α/2)√((1+1/r)p̄q̄) + z_(1-β)√(p₁q₁+p₂q₂/r)]²/(p₁-p₂)². These are planning estimates; confirm the final design with a qualified statistician.
From the odds ratio
An odds ratio of 2 with 0.2 of controls exposed means p₁ = 2 × 0.2 / 1.2 = 0.333: 172 cases and 172 controls.
Cases: 172 · Controls: 172 · Total: 344
Open this example in the calculatorTwo controls per case
The first example with 2 controls per case: 60 cases and 120 controls, fewer cases at the cost of more participants overall.
Cases: 60 · Controls: 120 · Total: 180
Open this example in the calculatorAllowing for incomplete data
Expecting 10% to have no usable exposure data: 82 / 0.9 = 91.1, so 92 cases and 92 controls are recruited.
Cases: 82 · Controls: 82 · Total: 164 · To recruit: 92 and 92
Open this example in the calculatorProtocol statement
To detect an odds ratio of 2.667 with 80% power at a two-sided significance level of 0.05, using a comparison of exposure between cases and controls, and assuming exposure in 20% of controls, the required sample size is 82 cases and 82 controls (164 in total). Allowing for 10% dropout, 92 cases and 92 controls (184 in total) should be recruited. Calculated with StatWisely (statwisely.com) using: n₁ = [z_(1-α/2)√((1+1/r)p̄q̄) + z_(1-β)√(p₁q₁+p₂q₂/r)]²/(p₁-p₂)². 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.
How to cite
StatWisely. Sample size to detect an odds ratio. Method document, engine version 1.0.0, reviewed 2026-10-01. https://statwisely.com/methods/odds-ratio/
Cite the original references for the formulas your design uses as well.
References
- 1.Lwanga SK, Lemeshow S. Sample Size Determination in Health Studies: A Practical Manual. Geneva: World Health Organization; 1991.
- 2.Fleiss JL, Levin B, Paik MC. Statistical Methods for Rates and Proportions. 3rd ed. Hoboken, NJ: John Wiley & Sons; 2003.