Skip to content
Scintria
ToolsGrant writerFunding
HomeLiteratureClinical trialsEvidence LabProtocol packData analysisLearnProjectsLibraryReferencesApplications
Start free
ScintriaStart free

Learn / Biostatistics / Sample size and power

Calculating sample size for means, proportions and events

15 minute read · 6-question quiz

Download this lesson as a colour Word or PDF study guide with the figures and answers. Included in paid plans; reading and quizzes stay free.Sign in

What you will learn

  • Calculate per-arm sample size for comparing two means and two proportions

  • Calculate the sample size for estimating a single proportion with a given precision

  • Estimate the number of events needed for a survival trial

These formulas are for a two-sided test with equal-sized groups. Software (Stata, R, G*Power, PASS) gives the same answers; understanding the formula lets you check the output and explain it to a committee.

Let z_(1-α/2) be the normal value for the significance level (1.96 for α = 0.05) and z_(1-β) for power (0.84 for 80%, 1.28 for 90%).

1. Comparing two means

n_(per arm) = (2 σ^2 (z_(1-α/2) + z_(1-β))^2)/(Δ^2)

where σ is the common SD and Δ the difference to detect.

Worked example: blood pressure trial

SD = 15 mmHg, minimal important difference = 5 mmHg, α = 0.05, power 80%:

n = (2 × 15^2 × (1.96 + 0.84)^2)/(5^2) = (2 × 225 × 7.85)/(25) = 141.3, so 142 per arm (284 in total).

With 90% power: (1.96 + 1.28)^2 = 10.51, giving n = 189.1, so 190 per arm (380 total).

2. Comparing two proportions

n_(per arm) = ([ z_(1-α/2)sqrt(2p(1-p)) + z_(1-β)sqrt(p_1(1-p_1) + p_2(1-p_2)) ]^2)/((p_1 - p_2)^2), p = (p_1 + p_2)/(2)

Worked example: an infection trial

Standard care leaves 30% of patients with infection (p_1 = 0.30). We want to detect a fall to 20% (p_2 = 0.20), α = 0.05, 80% power. \bar p = 0.25.

n = ([1.96sqrt(2 × 0.25 × 0.75) + 0.84sqrt(0.21 + 0.16)]^2)/(0.10^2) = ([1.96 × 0.612 + 0.84 × 0.608]^2)/(0.01) = 293.2

294 per arm (588 total). With 90% power: 392 per arm. If the baseline rate were 10% and we wanted to detect a drop to 5%, we would need 435 per arm: a small absolute difference at a low event rate demands a large trial.

05001000Participants per arm (80% power)29430% to 20%38850% to 40%43510% to 5%125130% to 25%
The sample size depends on the absolute gap and on the baseline rate. A 5-point difference (30% to 25%) needs 1,251 per arm.

3. Estimating one proportion (survey)

n = (z_(1-α/2)^2 p(1-p))/(d^2)

where p is the expected prevalence and d the desired half-width of the 95% CI. If p is unknown, use 0.5, which gives the largest n.

Worked example: a prevalence survey

Expected prevalence of anaemia 30%, desired precision ±5 percentage points:

n = (1.96^2 × 0.30 × 0.70)/(0.05^2) = (3.8416 × 0.21)/(0.0025) = 322.7, so 323 participants. If p is unknown: 3.8416 × 0.25/0.0025 = 384.2, so 385, the familiar number from many survey protocols.

For a household cluster survey, multiply by the design effect (next lesson).

4. Survival: number of events

For 1:1 allocation, the number of events (not participants) needed to detect a hazard ratio HR is

d = (4 (z_(1-α/2) + z_(1-β))^2)/([ln(HR)]^2)

Worked example: mortality trial

To detect HR = 0.70, α = 0.05, 80% power: d = (4 × 7.85)/((ln 0.70)^2) = (31.4)/(0.1272) = 246.8, so 247 events. The number of participants then depends on the expected event rate and follow-up: if 25% of control patients and about 18% of treated patients are expected to die over the trial, you need about 247 / 0.215 ≈ 1,150 participants.

Other outcomes

  • Counts / rates: use the Poisson formula or software, based on the expected rate in controls and the rate ratio.
  • Correlation, regression, diagnostic accuracy each have their own formulas; for diagnostic studies, sample size depends on the expected sensitivity and the required CI width.
  • Several primary outcomes: use the largest required n, or adjust α.

Always show your working in the protocol

Quote the formula or software, all four inputs with their sources, and the final number. Include a sensitivity table (e.g. n for SD 12, 15 and 18, and power 80% and 90%), so reviewers see how robust the plan is.

Summary

  • Two means: n = 2σ²(z + z)²/Δ² per arm; 5 mmHg with SD 15 needs 142 per arm for 80% power.

  • Two proportions: use the pooled-variance formula; absolute differences at low baseline rates need large trials.

  • A prevalence survey needs n = 1.96² p(1 − p)/d²; use p = 0.5 when unknown (385 for ±5%).

  • Survival trials are driven by events: d = 4(z + z)²/(ln HR)².

Check your understanding

Question 1
1

A trial needs 142 per arm with 80% power. Roughly how many per arm for 90% power with everything else the same?

Question 2
2

Expected prevalence unknown; precision ±5%, 95% confidence. The safe sample size is about:

Question 3
3

To detect a hazard ratio of 0.7 with 80% power and α = 0.05, the number of EVENTS needed is about:

Question 4
4

Which change increases the needed sample size most?

Question 5
5

In the formula for two means, doubling the SD does what to n?

Question 6
6

Why does survival-trial sample size focus on events?

Draft study guide. Spotted an error or something unclear? Tell us at hello@scintria.com. This is educational material, not clinical or regulatory advice.

Why sample size matters: the four ingredients of powerClusters, non-inferiority, attrition and writing the section