Paritian

Statistics

Sample Size for Comparing Two Means

How many subjects you need per group to detect a given difference between two averages.

Results

People needed in each group 63
People needed in total 126
Effect size (Cohen's d) 0.5000
How it changes
People needed in each groupDifference you want to detect 1.25 – 10.00. People needed in each group: 1005 → 16People needed in each group0500100015002.004.006.008.0010.00Difference you want to detect

The dashed line marks the value you entered.

What this tool does

Two things decide this, and only two: how big a difference you care about, and how much the measurements scatter within each group. Their ratio is Cohen's d, and once you have that the sample size follows. The relationship is unforgiving — the sample needed grows with the square of the scatter and shrinks with the square of the difference, so halving the gap you want to detect costs you four times the participants. This uses the normal approximation, which runs a little optimistic for small samples; if the answer comes out under about thirty per group, treat it as a floor rather than a target.

Formula

n per group = 2 × (z for confidence + z for power)² × spread² ÷ difference²

Variables

SymbolMeaningUnit
sdSpread within each group
dlDifference you want to detect
zaHow sure you want to be
zbChance of catching a real difference
NPeople needed in each group
TPeople needed in total
DEffect size (Cohen's d)

Worked example

  • Spread within each group10
  • Difference you want to detect5
  • How sure you want to be1.959963984540054
  • Chance of catching a real difference0.8416212335729143
  • People needed in each group63
  • People needed in total126
  • Effect size (Cohen's d)0.5000

Limitations

  • The result is an estimate based only on the values you type. Real situations often include factors this calculator does not know about.
  • Standard deviation and variance are calculated for a sample (dividing by n − 1). For a full population, divide by n instead.
  • The calculation runs at full precision and only the display is rounded. If you copy an intermediate value and retype it, small differences can appear.