Statistical power is the probability of detecting a real effect if one exists. Convention: aim for 80% power. Power analysis links four quantities — sample size, effect size, significance level, and power — so you can solve for any one given the other three.
To detect a standardised effect with 80% power at the 5% level takes about 393 people per group for d = 0.2, 63 for d = 0.5 and 25 for d = 0.8. A study with 30 per group has only 49% power for a medium effect of 0.5 — a coin flip whether it finds an effect that is really there.
- Power calculations need a guess of the effect size; guessing from a small pilot study usually overestimates it.
- Computing “observed power” after a study is uninformative; it is just a restatement of the p-value.
- Low-powered studies that do find effects tend to exaggerate them (Button et al. 2013).
from scipy.stats import norm
z = norm.ppf(0.975) + norm.ppf(0.80)
n_per_group = {d: int(np.ceil(2 * z ** 2 / d ** 2)) for d in (0.2, 0.5, 0.8)} # normal approximation
power_30 = norm.cdf(0.5 * np.sqrt(30 / 2) - norm.ppf(0.975)) # d = 0.5 with 30 per groupAssumes import numpy as np and import pandas as pd (and SciPy where imported). Each snippet simulates or makes up its own data, as the comments say.
The same idea with a library
# Python — power analysis from statsmodels.stats.power import TTestIndPower analysis = TTestIndPower() # How many samples for d=0.5, power=0.8? n = analysis.solve_power( effect_size=0.5, power=0.8, alpha=0.05 ) print(f"Need {n:.0f} per group") # Power curve import matplotlib.pyplot as plt ns = range(10, 200) powers = [analysis.power(effect_size=0.5, nobs1=n, alpha=0.05) for n in ns] plt.plot(ns, powers); plt.axhline(0.8, ls='--'); plt.show()
- Statistical Power Analysis for the Behavioral Sciences (2nd ed.), J. Cohen, Lawrence Erlbaum, 1988
- K. S. Button et al., “Power Failure: Why Small Sample Size Undermines the Reliability of Neuroscience”, Nature Reviews Neuroscience 14, 2013
- Trustworthy Online Controlled Experiments, R. Kohavi, D. Tang & Y. Xu, Cambridge University Press, 2020
Last reviewed October 2026 · How this site checks its content · Report a mistake
1. An A/B test was planned with 80% power to detect a 2-point lift. What does the 80% mean?
Show answer
C. Power is a property of the design: the probability of a significant result given an effect of the stated size. It says nothing about how likely the effect is to exist.
2. To detect an effect half as large with the same power and significance level, the sample size must be about…
Show answer
A. The standard error shrinks with √n, so halving the effect you want to see requires √n to double — four times the sample.
3. A small study finds a significant and surprisingly large effect. Why be cautious?
Show answer
A. Gelman & Carlin call this a Type M (magnitude) error: with low power, a significant estimate is often several times the true effect.
- MLOps & Production MLIncident Response for MLWhen models fail in production — rollback, fallback, postmortem
- The ToolkitFunnel & Conversion AnalysisWhere do users leak out? Stage conversions, drop-offs, and fixing the right bottleneck
- The ToolkitHypothesis Testing & p-valuesNull vs alternative, what a p-value actually means, and the two ways to be wrong