Research toolsStudy design
Sample size for comparing two proportions
Calculates how many participants per group are needed to detect a difference between two independent proportions, at a chosen significance level and statistical power.
These are the values under the alternative hypothesis — the difference you want the study to be able to detect.
1 for equal groups. 2 means twice as many in group 2.
Results
- Total participants
- 186
- Group 1
- 93
- Group 2
- 93
- Per group, before rounding
- 92.999
- Critical values
- z₁₋α⁄₂ = 1.9600z₁₋β = 0.8416
This is the sample for the primary outcome. Secondary outcomes and subgroups will be under-powered at this size.
When to use it
- Powering a two-arm trial with a binary outcome.
- Planning a cohort or case–control study comparing two groups.
- Checking whether a proposed study is large enough to answer its question at all.
Formula
[ z₁₋α⁄₂ · √( (1 + 1/k) · p̄(1 − p̄) ) + z₁₋β · √( p₁(1−p₁) + p₂(1−p₂)/k ) ]²
n₁ = ──────────────────────────────────────────────────────────────────────────────
( p₁ − p₂ )²
n₂ = k · n₁
p̄ = (p₁ + k·p₂) / (1 + k) the weighted pooled proportion
k = allocation ratio, n₂ : n₁ (k = 1 for equal groups)
z₁₋α⁄₂ = 1.959964 at α = 0.05 two-sided
z₁₋β = 0.841621 at 80% power, 1.281552 at 90% powerWorked example
A two-arm trial expecting 50% response on the new treatment and 30% on the control.
- Proportion, group 1
- 0.50
- Proportion, group 2
- 0.30
- Significance level
- 0.05, two-sided
- Power
- 80%
- Allocation
- 1 : 1
n = 92.998 per group, so 93 per group, 186 in total.
With 93 participants in each arm, a true difference of 20 percentage points would be detected about 80% of the time.