Power Analysis
Statistical power is the probability your study will detect a real effect of a given size; too little power and you waste a study. Pick a design (t-test, ANOVA, proportions, correlation, chi-square), supply three of the four key inputs (effect, alpha, power, n), and the calculator solves for the fourth.
New to power analysis? Read the 4-min primer ▾
What power is. Statistical power is the probability of detecting a real effect of a given size at a chosen alpha. Power = 0.80 means that if the effect you are positing actually exists, you have an 80% chance of getting a significant result, and a 20% chance of missing it (a Type II error). Pick the design first, then ask what power you can afford.
The four-way relationship. Sample size n, effect size, alpha, and power form a closed system: pin three, the fourth is forced. Bigger effects need fewer subjects. Tighter alpha (0.01 vs 0.05) costs sample size. Higher power (0.90 vs 0.80) costs sample size. Smaller effects cost the most: halving d roughly quadruples n.
How to read the result. If you solved for n, the number you get is the smallest sample that reaches the target power. If you solved for power, you get the probability of detecting the effect at the n you can collect. If you solved for the minimum detectable effect, the number is the smallest effect you have a chance of catching given your n, alpha, and target power.
Picking the design. Continuous outcome, two groups: two-sample t-test on Cohen's d. Continuous outcome, paired or single-arm: one-sample / paired t. Binary outcome, two arms: two-proportion test on Cohen's h. Multi-arm continuous: one-way ANOVA on Cohen's f. Bivariate Pearson correlation: correlation power on r. Goodness-of-fit or contingency: chi-square on Cohen's w with correct df.
Try a real-world example to load.
A typical two-arm trial: continuous outcome, medium effect, 80% power, alpha 0.05.
Read more Anatomy of a power calculation
pwr.2p.test and pwr.p.test. Falls apart when expected counts are tiny; switch to an exact test there.r · sqrt(n-2) / sqrt(1-r²) is more accurate, and its noncentral-t distribution gives the closed-form power. We use that direct formulation; results match pwr.r.test to 3+ decimals.Caveats When this is the wrong tool
- If you have…
- Use instead
- Clustered or hierarchical data (students in classes, patients in clinics)
- The independence assumption fails. Inflate your n by the design effect
1 + (m-1)ρwhere m is cluster size and rho is the intraclass correlation, or run a simulation against the mixed model you actually plan to fit. - Time-to-event / survival outcome
- The number of events drives power, not the number of patients. Use Schoenfeld's formula on the log hazard ratio, or simulate against a Cox model with realistic censoring; a dedicated survival power tool is on the roadmap.
- Bayesian a priori sample size
- Frequentist power asks "what's the long-run rejection rate?". A Bayesian sample size question (precision of a posterior, Bayes-factor design) is a different paradigm; use simulation against the prior + likelihood you actually plan to use.
- Pilot-study sample size
- Pilots are sized for feasibility (recruitment rate, dropout, instrument validity), not for hypothesis power. Cohen's tables don't apply; aim for ~12 per arm or follow a feasibility-specific guide.
- Complex models with no closed-form (mixed effects, GLMM, nested ANOVA)
- The closed forms here assume a single fixed effect with a known sampling distribution. For mixed models or non-trivial covariate structures, use simulation: generate datasets under H1, fit the model, count rejections.
- Power analysis in R with the
pwrpackage. - Sample size planning in R for typical designs.
- Effect size in R (the
effectsizepackage). - Effect Size Converter - turn between d, r, OR, eta-squared.
- Type I and Type II errors for the alpha / beta / power triangle.
Numerical methods: noncentral t via Sankaran (1959); noncentral F and chi-square via Poisson-weighted CDF series; proportions via Cohen's h and the standard normal approximation. Verified against the R pwr package to ~3 decimal places.