Sampling/
Randomized Controlled Trial
Sample Size Estimation, Measuring Change
How to Calculate Sample Size for a Randomized Controlled Trial
A randomized controlled trial compares outcomes between a treatment arm and a control arm assigned at random. This guide explains the underlying statistics first, then shows how to apply them using AnalyZ Solutions.
7 min read
Sample Size Estimation
Intermediate
A randomized controlled trial assigns participants to a treatment arm and a control arm at random, then compares outcomes between them. Random assignment is what allows any observed difference to be attributed to the intervention itself, but that comparison is only trustworthy if each arm is large enough to reliably detect a real effect. This guide first explains the general formula behind the calculation, then walks through how to apply it in AnalyZ Solutions.
01The general sample size formula
An RCT can compare either a proportion outcome (a rate, such as percentage employed) or a continuous outcome (a numeric score, such as average income). Each uses its own formula.
For a proportion outcome, comparing the rate in the control arm against the rate in the treatment arm:
n per arm = (Z1−α/2√(2p̄q̄) + Z1−β√(p₁q₁+p₂q₂))2 / (p₁−p₂)2
For a continuous outcome, comparing the mean in each arm:
n per arm = 2(Z1−α/2 + Z1−β)2 × σ2 / Δ2
Both formulas share two ingredients beyond the effect size itself.
- Confidence level (1 − α). Conventionally 95%, meaning a 5% chance of concluding there is an effect when there is not one, a false positive.
- Statistical power (1 − β). Conventionally 80%, meaning an 80% chance of detecting the effect if it is really there. High stakes decisions often warrant 90%.
Choosing your confidence level and power
Confidence level and power are judgment calls, not fixed rules, and they deserve as much thought as the effect size itself.
Confidence level reflects how willing you are to risk a false alarm, concluding the intervention had an effect when it actually did not. 95% is the standard default, meaning a 5% chance of that false alarm. A higher level, such as 99%, is worth considering before a costly or hard to reverse decision, such as scaling an intervention nationally based on the trial result. A lower level, such as 90%, is sometimes acceptable for lower stakes, exploratory pilots.
Power reflects how willing you are to risk missing a real effect entirely. 80% power is the conventional minimum, meaning a 20% chance of failing to detect a genuine effect of the size specified. 90% power is worth considering for high stakes trials, such as one that determines whether an intervention receives continued funding.
An underpowered trial is not just a wasted opportunity. A no significant effect result from an underpowered trial is genuinely uninformative. It cannot distinguish the intervention does not work from the trial was too small to tell. A confidence level set too low, meanwhile, increases the risk that an apparent effect is actually just noise, potentially leading to scaling an intervention that does not really work. Register the power calculation in the trial protocol before data collection begins. Once data collection is complete, there is no way to fix an underpowered trial after the fact.
One-tailed or two-tailed
The formulas above use Z1−α/2, the two-tailed critical value, appropriate when testing for a difference in either direction. A one-tailed test, appropriate only when a change in one specific direction is the sole interest, uses Z1−α instead, a smaller value that produces a smaller required sample for the same nominal confidence level. Two-tailed is the safer, more conventional default.
How to Calculate This in AnalyZ Solutions
The RCT tool in the Sampling module applies both formulas above automatically, along with attrition and design effect adjustments.
- Choose your outcome type. Select Proportion outcome or Continuous (mean) outcome. This determines which formula and which inputs follow.
- Set confidence and power. Enter both as numbers, not from a fixed list.
- Enter the effect you want to detect. For a proportion outcome, enter the expected rate in the control group and the expected rate in the treatment group. For a continuous outcome, enter the expected standard deviation and the expected difference between arms.
- Set expected attrition. This inflates the per-arm recruitment target so the analysed sample still meets the statistical minimum after losses to follow-up.
- Choose one-tailed or two-tailed. Two-tailed is selected by default and is appropriate for almost all trials.
- Set a design effect, if cluster-randomised. If whole groups, such as clinics or schools, are randomised rather than individuals, enter a design effect directly or calculate one from an intraclass correlation and average cluster size. It defaults to 1, meaning no clustering effect, and is always editable.
VIDEO WALKTHROUGH PLACEHOLDER, 90 SECONDS
A short screen recording showing these steps in the AnalyZ Solutions interface can be embedded here.
02Worked example
Suppose you are evaluating a job readiness training programme. Currently 40% of a comparable population finds employment within six months. You expect the programme to lift this to 55%. You want 80% power at 95% confidence, two-tailed, and expect 15% attrition by endline.
Inputs
Outcome typeProportion
Confidence level95%
Power80%
Control group rate40%
Treatment group rate55%
Test typeTwo-tailed
Expected attrition15%
~171
to recruit per arm, 342 total
03Common mistakes to avoid
- Powering for every outcome measured, not the primary one. Power the trial for its pre-specified primary outcome. Reporting additional outcomes is fine, but powering for all of them inflates the sample and invites multiple comparison problems.
- Randomising clusters but using the individual-level formula. If clinics, schools, or villages are assigned to arms rather than individuals, the design effect must be applied, or the trial will likely be underpowered.
- Choosing an unrealistically large expected effect. Sizing a trial around an optimistic effect that does not materialise is a common way evaluations end up underpowered in practice.
Frequently Asked Questions
Should I power my trial for every outcome I plan to measure?
No. Power the trial for its pre-specified primary outcome. Secondary outcomes can still be reported, but powering for every outcome measured inflates the required sample unnecessarily.
What if I want unequal arm sizes, such as two treatment participants for every one control?
The tool assumes equal arm sizes, which is standard for most impact evaluations. Unequal allocation typically requires a larger total sample for the same power, and is usually only worthwhile when the treatment is substantially more costly to deliver than to measure.
How is this different from the Change in Proportion tool?
The statistics are closely related, but RCT specifically assumes random assignment to arms and adds attrition handling. Use Change in Proportion when there is no randomisation, such as a natural comparison or a single group tracked over time. See the dedicated guide on
Detecting a Change in Proportion.
When should I use a one-tailed test instead of two-tailed?
Only when a change in one specific direction, such as an improvement, is the sole outcome of interest, and a change in the opposite direction would not need to be detected or reported. This is uncommon in most programme evaluation contexts, which is why two-tailed remains the default.
Ready to power your trial?
Open the RCT tool in AnalyZ Solutions. Free, browser based.
Try it out
Related Guides