MathsStatistics & Probability

Power Analysis
calculator.

Statistical power is your study's chance of detecting an effect that is really there.

How it's worked out

Four things are tied together: the effect size, the sample size, the significance level α and the power. Fix any three and the fourth follows, so you can solve for the size of a planned study, the power of one whose size is already set, or the smallest effect a fixed sample can find.

Power is the chance the test statistic lands past the cut-off when the effect is real. A real effect shifts the statistic away from zero by an amount called the noncentrality. For t-tests, with d as Cohen's d (the difference in means divided by the standard deviation):

one sample or paired: δ\displaystyle \text{one sample or paired: } \delta=dn\displaystyle {}= d\sqrt{n}
two samples: δ\displaystyle \text{two samples: } \delta=dn2\displaystyle {}= d\sqrt{\frac{n}{2}}

The t-test figures come from integrating the noncentral t distribution, not from the normal shortcut, which can run a subject or two short. Tests of proportions use Cohen's h on a normal curve. Chi-square tests use the noncentral chi-square curve.

h\displaystyle h=2arcsin⁡p2−2arcsin⁡p1\displaystyle {}= 2\arcsin\sqrt{p_2} - 2\arcsin\sqrt{p_1}
λ\displaystyle \lambda=nw2\displaystyle {}= n w^2

Here w is Cohen's w, the effect size for a chi-square test, and λ is the noncentrality. The sample size you get is the smallest whole n whose power reaches your target. As the pwr package notes, always round up.

Worked examples

A two-group experiment expecting a medium effect

To detect d = 0.5 with a two-sided test at α = 0.05 and 80% power, you need 64 per group, 128 in total. That size gives 80.1% power. Raising the target to 90% takes 86 per group.

A one-sided test needs 51 per group, but it fits only if an effect in the other direction would count as no effect. If you expect to lose 15% of people, recruit 76 per group, not the 74 you get from multiplying by 1.15.

Open this example in the tool

Will a new page lift conversions from 10% to 15%?

This gap has h = 0.152, under Cohen's small mark of 0.2. At α = 0.05 and 80% power it needs 681 visitors per version, 1,362 in total.

The same five points costs far more in the middle of the range. Going from 50% to 55% takes 1,565 per version, because proportions vary most near one half.

Open this example in the tool

What can 30 paired people detect?

With 30 pairs at 80% power and α = 0.05, the smallest effect you can reliably pick up is d = 0.529. If the effect you expect is smaller than that, the study is underpowered before it starts.

A large effect needs far fewer people. In a two-group study, 20 per group has 86.9% power for d = 1.

Open this example in the tool

Reading your result

The effect size is the input that moves everything. Halving it about quadruples the sample, because n grows with 1d2\frac{1}{d^2}. At 80% power, d = 0.5 needs 64 per group, d = 0.25 needs 253, and d = 0.2 needs 394.

Sample size per group, two-sample t-test, two-sided, α = 0.05
d80% power90% power95% power
0.2394527651
0.3176235290
0.4100133164
0.56486105
0.6456074
0.8263442
1172327

Read n the right way for your test. Two-sample and two-proportion results are per group, paired results count pairs, and chi-square results count all observations. A 3 by 2 table with w = 0.3 has 2 degrees of freedom and needs 108 observations in total.

Know what the sums assume. The t-test figures assume normal data, equal standard deviations and equal group sizes. The proportion figures use the arcsine approximation. Designs with clusters, repeated measures or several comparisons need more than this.

Common mistakes

  • Multiplying by 1 plus the dropout rate. A common error: divide by the share who stay. With 64 needed and 15% lost, multiplying recruits 74. That leaves too few once you take the 15% away.
  • Working out power after the study from the effect you found. Observed power is a one-to-one function of the p-value, so it cannot explain a non-significant result. Report an interval instead.
  • Planning around one published effect. Effects from a small pilot or a single paper tend to run high, which leaves your study short. Plan on the smallest effect that would matter to you.
  • Using a medium effect because it is the default. The small, medium and large labels are a fallback. They say nothing about your field or your outcome.

Questions people ask

It depends on the test. Two-sample t-tests and two-proportion tests give n per group, so double it for the total. One-sample, paired and chi-square results are already the full count, of people, pairs or observations.

Sources