Statistics and research

Power and sample size calculator

Statistical power or the sample size needed for one-sample, paired and two-sample t-tests and for comparing two proportions.

Runs in your browser. What you enter stays on this page and is not uploaded.

Results

n23 per groupPower at that n0.9125
Test
Two-sample t-test, two-sided
Effect
δ = 1, σ = 1 (standardized effect d = 1)
Significance level α
0.05
Exact n solving the power equation
22.021096
Sample size to plan (rounded up)
23 per group (46 in total)
Power achieved at the rounded n
0.912498

As R power.t.test and power.prop.test: the t-test power uses the noncentral t distribution; the small chance of rejecting in the wrong direction is ignored.

Method and limits

How to use it

Choose the test and whether to solve for the sample size or the power. Enter the smallest difference worth detecting and its standard deviation (for proportions, the two expected proportions), the significance level and the sides.

Formulas

  • t-tests: power = P(T′ > tα/s, ν), where T′ has the noncentral t distribution with ν = g(n − 1) df and noncentrality √(n/g) δ/σ; g = 2 for two-sample tests, 1 for one-sample and paired; s is the number of sides. The noncentral t uses Lenth’s algorithm AS 243, switching to numerical integration where that series loses precision.
  • Two proportions: power = Φ((√n |p₁ − p₂| − zα/s √((p₁ + p₂)(q₁ + q₂)/2)) / √(p₁q₁ + p₂q₂)).
  • Sample size: the exact n solving the power equation (Brent’s method), then rounded up.
  • These match R’s power.t.test and power.prop.test (strict = FALSE: the tiny chance of rejecting in the wrong direction is ignored).

Assumptions and limits

  • The effect size must come from outside the study (a pilot, earlier studies or the smallest important difference) — post hoc power from the observed effect adds nothing to the p-value.
  • n is per group for two-sample tests and the number of pairs for paired tests. Plan extra for dropout.
  • For a paired test, σ is the SD of the differences, not of each measurement.

Worked example

R’s power.t.test examples: 20 per group, δ = 1, σ = 1, two-sided α = 0.05 gives power 0.869; for 90% power you need n = 22.02, so 23 per group (power 0.912). power.prop.test with 50 per group and proportions 0.50 versus 0.75 gives power 0.740.

References

Related tools

Share this page

Remind me to visit Contifield

Adds a repeating reminder to your calendar, titled “Contifield Reminder: Visit www.contifield.com”.