Calculators · §2
Form MS-C2
Independent t-test · exact noncentral t

Sample size for comparing two means

How many participants per group to detect a difference in a continuous outcome — blood pressure, length of stay, a lab value, a score.

Means calculations use the exact noncentral t distribution (Lenth 1989), so small samples are handled correctly. A planning estimate, not a substitute for a statistician.

Method & formula

Most online calculators use the normal approximation, which overstates power (and understates the n you need) in small samples. This one uses the exact noncentral t distribution (algorithm AS 243) and searches for the smallest n that reaches your target power — the same computation as R's power.t.test, against which it is validated. With the defaults (difference 5, SD 10, α = 0.05, 80% power) both give 64 per group.

What drives the answer is the standardized difference δ/σ: halving the detectable difference quadruples the required sample.

Source: Lenth RV. Algorithm AS 243 — cumulative distribution function of the non-central t distribution. Appl Statist 1989;38:185–89.

Inputs, explained

Meaningful difference in means
The smallest difference that would matter clinically — not the difference you hope to see. In the units of your outcome.
Standard deviation (SD)
The SD of the outcome within a group, from a pilot, a published table 1, or (range ÷ 4) as a crude fallback.
Allocation ratio (n2/n1)
1 for equal groups. Unequal allocation costs efficiency: 2:1 needs about 12% more participants in total for the same power.

A sample size is one line of a statistical plan. MedStatica turns a plain-language description of your study into the full plan — design, recommended analysis, power, causal diagram, methods paragraph, and runnable R, Python, SAS, and Stata code. The first plans are free, no card required.

Plan my study free →

Related calculators: paired t-test · one mean vs a reference value · comparing two proportions · all calculators