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
- 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
- R documentation: power.t.test
- R documentation: power.prop.test
- Lenth (1989), Algorithm AS 243: cumulative distribution function of the non-central t distribution, Applied Statistics 38
- Faul, Erdfelder, Lang and Buchner (2007), G*Power 3, Behavior Research Methods 39
- Cohen, J. (1988), Statistical Power Analysis for the Behavioral Sciences, 2nd ed., Routledge
Related tools
- T-test calculatorOne-sample, independent two-sample (Welch and pooled) and paired t-tests from raw data or summary statistics, with confidence intervals and Cohen’s d.
- Mann–Whitney U test calculatorWilcoxon rank-sum (Mann–Whitney U) test for two independent samples, exact for small samples without ties, with the rank-biserial effect size.
- Wilcoxon signed-rank test calculatorWilcoxon signed-rank test for paired samples or one sample against a median, exact for small samples, with the matched-pairs rank-biserial correlation.
- Effect size calculatorCohen’s d, Hedges’ g and Glass’s Δ from group means, or odds ratio, risk ratio and risk difference from a 2×2 table, each with confidence intervals.
- P-value calculatorFind the p-value and critical values for a z, t, chi-square or F test statistic, one- or two-tailed, accurate far into the tails.
- Sample size calculatorSample size to estimate a proportion or a mean within a chosen margin of error, with the finite population correction for small populations.