Method document
Sample size to detect a relative risk
How many exposed and unexposed participants are needed to show that an exposure changes the risk of an outcome, from the risk among the unexposed and either the risk among the exposed or the relative risk. Covers unequal groups and dropout.
https://statwisely.com/methods/relative-risk/
When to use it
- A cohort study, or a trial reported as a relative risk, comparing the risk of an outcome between exposed and unexposed groups.
Not for
- Case-control studies, where the relative risk cannot be estimated. Use the odds ratio.
- Time-to-event outcomes with varying follow-up. Use survival analysis.
Notation
- Number of exposed participants
- Unexposed per exposed participant
- Expected risk among the exposed and the unexposed
- Risk in the two groups combined
- Relative risk, p₁ / p₂
- Significance level: the chance of a false positive
- Power: the chance of detecting the effect if it is real
- Expected dropout
Formulas
Exposed participants needed
Detecting a relative risk different from 1 is detecting a difference in risk, so the calculation is the comparison of two proportions [1, 2]. Unexposed are ⌈r_a n⌉; the test is two-sided.
Dropout
Applied last, to the participants actually recruited.
Parameters
Risk among the unexposed
Values: Between 0 and 1
The baseline risk over the follow-up, often from routine data.
Risk among the exposedOptional
Values: Between 0 and 1
Give this or the relative risk.
Relative risk to detectOptional
Values: Above 0, not 1, with RR × p₂ below 1
The smallest relative risk worth detecting, instead of p₁.
Unexposed per exposedOptional
Values: Above 0; 1 for equal groups
When the exposure is uncommon, the unexposed group is often larger.
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
- The groups are independent and followed for the same period, so the outcome is a risk over a fixed time.
- 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
A doubling of risk
Risk 0.3 among the exposed against 0.15, a relative risk of 2; α = 0.05, 80% power: 121 exposed and 121 unexposed.
Exposed: 121 · Unexposed: 121 · Total: 242
Open this example in the calculatorProtocol statement
To detect a relative risk of 2 with 80% power at a two-sided significance level of 0.05, using a comparison of risk between exposed and unexposed participants, and assuming a risk of 15% among the unexposed, the required sample size is 121 exposed and 121 unexposed participants (242 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.
A smaller relative risk
A relative risk of 1.5 on a baseline of 0.15 means p₁ = 0.225: 424 in each group. Smaller effects cost many more participants.
Exposed: 424 · Unexposed: 424 · Total: 848
Open this example in the calculatorTwice as many unexposed
The first example with 2 unexposed per exposed: 88 exposed and 176 unexposed.
Exposed: 88 · Unexposed: 176 · Total: 264
Open this example in the calculatorAllowing for loss to follow-up
Expecting 20% lost to follow-up: 121 / 0.8 = 151.3, so 152 are recruited in each group.
Exposed: 121 · Unexposed: 121 · Total: 242 · To recruit: 152 and 152
Open this example in the calculatorProtocol statement
To detect a relative risk of 2 with 80% power at a two-sided significance level of 0.05, using a comparison of risk between exposed and unexposed participants, and assuming a risk of 15% among the unexposed, the required sample size is 121 exposed and 121 unexposed participants (242 in total). Allowing for 20% dropout, 152 exposed and 152 unexposed participants (304 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 a relative risk. Method document, engine version 1.0.0, reviewed 2026-10-01. https://statwisely.com/methods/relative-risk/
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.