Calculator · deterministic
Two-sample t-test sample size calculator
Comparing the means of two independent groups: participants per arm from Cohen's d, α and power.
Calculator
No AI, no sign-up — the arithmetic runs in the server-side deterministic solver, validated against G*Power and R pwr.
When to use it
Use this when a continuous outcome (pain score, lab value, scale score) is compared between two separate groups: treatment vs control, two techniques, two devices. If you measure the same person before and after, you need the paired t-test calculator instead — the two sample sizes are not interchangeable.
Where the inputs come from
- Cohen's d: define the important difference in the outcome's own units first, then divide by the within-group SD from comparable publications. The derivation steps are in the effect size guide.
- α and power: the common convention is 0.05 and 80%; do not change them without a stated reason.
- Available participants (optional): if your case volume is capped, enter it — the calculator also reports the smallest detectable effect for that n.
Worked example
Say the target difference is 1.5 points and the expected within-group SD is 3: d = 1.5 / 3 = 0.50. With two-sided α = 0.05 and 80% power the solver requires 64 per arm, 128 analyzable participants in total. Expecting 20% attrition raises the recruitment target to 160. If only 100 participants are within reach, the smallest detectable effect at the same power is d ≈ 0.57 — if your target difference is smaller than that, do not start without enlarging the study.
How to write it in the protocol
“For the primary outcome [measure], the target difference [Δ, units] and the expected within-group SD [value] gave d = [value]. A two-sample t test with two-sided α = 0.05 and 80% power required [n] participants per arm; allowing [x]% attrition, the recruitment target was [N].”
Sources
- Cohen J. Statistical Power Analysis for the Behavioral Sciences, 2nd ed. Lawrence Erlbaum; 1988.
- Faul F, Erdfelder E, Lang A-G, Buchner A. G*Power 3: a flexible statistical power analysis program. Behav Res Methods. 2007;39:175–191.
- Champely S. pwr: Basic Functions for Power Analysis (R package).