Common inputs
Power is the probability that the planned test rejects the null hypothesis when the effect you entered is real. α is the significance level. A two-sided test splits α across both directions; a one-sided test puts all of α in the direction you expect, and its power assumes the true effect runs in that direction.
Throughout, k is the number of tails (1 or 2), Φ is the standard normal distribution function, and zp is its p-th quantile. StatPower uses the absolute value of the effect you enter.
Two independent means
The effect is Cohen’s d: the difference between group means divided by the common standard deviation. Groups are equal in size, n per group, and the test is Student’s two-sample t test.
df = 2n − 2 λ = d·√(n / 2) t* = t1−α/k, df
Power (two-sided) = P(T > t*) + P(T < −t*) Power (one-sided) = P(T > t*)
where T follows a noncentral t distribution with df degrees of freedom and noncentrality λ
This is the exact method, the same one used by R’s pwr and power.t.test and by G*Power.
Examples. For d = 0.5, α = .05, two-sided, 80% power: 64 per group (128 total). With 40 per group, power for d = 0.5 is 59.8%. With 50 per group and 80% power, the minimum detectable effect is d = 0.566.
One mean or paired means
The effect is the mean (or, for paired data, the mean difference) divided by its standard deviation. For paired designs, n is the number of pairs and the standard deviation is that of the differences (often written dz), not of the raw scores. Using the raw-score SD instead can overstate or understate the sample size, depending on how strongly the paired scores are correlated.
df = n − 1 λ = d·√n t* = t1−α/k, df
Power: as above, with T noncentral t(df, λ)
Example. For d = 0.5, α = .05, two-sided, 80% power: 34 participants (or pairs).
Correlation
The effect is the population Pearson correlation r, tested against zero, with n total observations. StatPower uses Fisher’s z transformation with a normal approximation:
zr = atanh(r) λ = zr·√(n − 3) z* = z1−α/k
Power (two-sided) = Φ(−z* − λ) + 1 − Φ(z* − λ) Power (one-sided) = Φ(λ − z*)
Example. For r = 0.3, α = .05, two-sided, 80% power: 85 participants.
Results agree closely with R’s pwr.r.test. At very small samples StatPower is slightly conservative: it may ask for one more participant, and at n = 10 its power can read up to about 3 points lower.
Two independent proportions
You enter a baseline rate p1 and an absolute change, so the comparison rate is p2 = p1 + change. The effect is Cohen’s h, the difference between arcsine-transformed proportions, with n per group and a normal approximation:
h = 2·arcsin(√p2) − 2·arcsin(√p1) λ = |h|·√(n / 2)
Power (two-sided) = Φ(−z* − λ) + 1 − Φ(z* − λ) Power (one-sided) = Φ(λ − z*)
Example. From 30% to 40% (h = 0.210), α = .05, two-sided, 80% power: 356 per group (712 total).
This matches R’s pwr.2p.test exactly. Software that uses the pooled-variance method instead, such as R’s power.prop.test, can give sample sizes that differ by up to about 1%.
How results are solved
- Sample size: the smallest whole number of participants (per group, where relevant) whose power reaches the target. The search starts from the normal-approximation answer and steps to the exact one.
- Power: computed directly from the formulas above.
- Minimum detectable effect: the effect size at which power equals the target, found by numerical bisection.
- Noncentral t: computed with algorithm AS 243 (Lenth, 1989), the basis of R’s own implementation, including R’s safeguards for very large noncentrality. t critical values use Newton’s method on the incomplete beta function.
Every calculation runs in your browser; nothing is sent to a server.
Validation
StatPower’s calculation code is tested against the R package pwr (version 1.3.0, R 4.6.0) across 664 cases: all three solve modes, α = .05 and .01, one- and two-sided tests, a range of effect sizes, and samples from 2 to 20,000. The tests run on the same code that the site serves, and are rerun whenever that code changes.
| Design | Result against R |
|---|---|
| Two independent means | Exact match in every case |
| One mean or paired means | Exact match in every case |
| Two independent proportions | Exact match in every case |
| Correlation | Close; slightly conservative at very small samples (see above) |
What these calculations don’t cover
- Unequal group sizes or unequal variances (Welch’s test).
- Clustering (students in classrooms, patients in clinics), repeated measures beyond simple pairs, and longitudinal designs.
- Attrition. If you expect to lose a share of participants, divide the required sample size by (1 − expected attrition rate). For example, 64 per group with 20% expected attrition means recruiting 80 per group.
- Multiple comparisons, covariates, ANOVA and regression models, and nonparametric tests.
- Observed (post hoc) power. Power computed from the effect you happened to observe says nothing new beyond the p-value. Plan with the smallest effect that would matter, or with independent prior evidence.
Most of all, every result depends on the effect size you enter. A sample size is only as credible as the effect it was planned for.
Designing a study these calculators don’t cover?
Get a design-specific power analysis ↗References
- Champely, S. (2020). pwr: Basic functions for power analysis (R package version 1.3-0).
- Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum Associates.
- Faul, F., Erdfelder, E., Lang, A.-G., & Buchner, A. (2007). G*Power 3: A flexible statistical power analysis program for the social, behavioral, and biomedical sciences. Behavior Research Methods, 39(2), 175–191.
- Fisher, R. A. (1915). Frequency distribution of the values of the correlation coefficient in samples from an indefinitely large population. Biometrika, 10(4), 507–521.
- Lenth, R. V. (1989). Algorithm AS 243: Cumulative distribution function of the non-central t distribution. Journal of the Royal Statistical Society, Series C (Applied Statistics), 38(1), 185–189.