Sample Size & Power
Plan sample size for an effect that matters, using the outcome variability and error rates appropriate to your design.
Why sample size matters
Power is the probability of rejecting the null for a specified effect size, design, and significance level. Set the effect size using the smallest difference that would change your decision.
The four levers
Power analysis balances four interconnected parameters. Adjusting one changes the required sample size:
Type I error risk: probability of a false positive.
Standard: 0.05 (5% risk). Lower α → larger sample needed.
Probability of detecting a real effect when one exists.
Standard: 0.80 or 0.90. Higher power → larger sample needed.
Smallest effect of interest: the difference that would change your decision.
Smaller difference to detect → much larger sample needed.
Noise level: natural data fluctuation.
More noise → larger sample needed to separate signal.
The formula
For a two-sample t-test with equal group sizes, the central-t approximation provides a planning formula.
where d = δ/σ (Cohen’s d), df = 2(n−1), and 1−β is target power. For a one-sided test use 1−α in place of 1−α/2.
Since Cohen’s d = δ / σ, a smaller raw difference (δ) or a larger standard deviation (σ) both shrink d, which increases the required sample size. This is why noisy data and small effects are so expensive to study.
Why we use the t-distribution
For the two-sample means example, the t reference accounts for estimating the common standard deviation. A normal-quantile calculation is an approximation for this setup.
Pooled and Welch t-statistics
The pooled-variance t-statistic follows a t-distribution under independent normal observations with a common variance. Welch’s procedure estimates separate variances and uses approximate degrees of freedom.
The t-distribution is wider than the normal, especially for small samples. This means t-critical values are larger than Z-critical values, which means you need more observations to achieve the same power.
Degrees of freedom
The t-distribution’s shape depends on degrees of freedom (df). For a two-sample t-test with n observations per group:
As df grows (larger samples), the t-distribution converges to the normal. The cards below compare critical values at several sample sizes.
How much does it matter?
The calculator uses the noncentral t-distribution under independent normal observations with a common variance. Its noncentrality is d√(n/2).
Reference tables
The reference tables give critical values for other degrees of freedom and significance levels.
Two-sample t-test calculator
Set your parameters for the two-sample means example. The calculation assumes independent normal outcomes, equal group sizes and a common population variance.
Sample size vs. Cohen’s d
This chart shows how the required sample size changes across a range of effect sizes, holding your current α and power constant. The red dot marks your current d.
Size an experiment for a difference in conversion
Count at most one conversion per randomized unit within the chosen window. A Bernoulli outcome has variance p(1 − p), a count over n independent units has variance np(1 − p), and the sample rate has variance p(1 − p)/n. More independent units reduce the variation of the rate. Review the two error rates in The Concepts.
Halve the MDE and compare the enrollment totals. Then restore 5 points and change the control rate. For a comparison family, enter the planned per-comparison alpha from Multiple comparisons across arms.
How the counts are calculated
Cohen’s h is 2 arcsin √poffer − 2 arcsin √pcontrol. For equal arms, use n = ⌈2[(z1−α/2 + zpower)/h]²⌉ as a planning approximation. With a larger-to-smaller ratio k, use 1 + 1/k in place of 2 for the smaller arm, then round the larger arm up at that ratio. Divide each required count by the expected observed fraction and round up again. At 20% → 25%, the full-precision quantiles give 1,092 per arm. Rounding the two quantiles to 1.96 and 0.84 first gives 1,091.
The MDE describes power to distinguish a specified lift from zero. A profitability decision uses its own break-even threshold and the interval around the estimate. Enrollment inflation addresses expected precision loss. Outcome-dependent missingness can still bias an analysis. This approximation is for independent units and needs adequate expected successes and failures.
Use these defaults to plan the 30-day offer experiment.
Plan for a difference in paired changes
Measure the same units once before and once after treatment. With common marginal outcome SD and correlation ρ, each arm’s change variance is Var(change) = 2 × SD² × (1 − ρ). The standard error is SE = √[Var(change in T)/nT + Var(change in C)/nC].
At the defaults, change variance is 100 per arm, SE is 2 outcome units, and the 80% minimum detectable effect is 5.60 outcome units.
This is a two-sided normal approximation for independent units in each arm. Additional waves require the covariance matrix of the planned contrasts. With assignment or dependence at a cluster level, plan using independent clusters, their sizes and within-cluster dependence.
To ask whether a pre-treatment trend violation would be detected, use the pre-trend sensitivity example. For a conversion trial, use Binary-outcome sizing.
What power looks like
Power is the probability of rejecting the null at a specified effect size. This two-sided visualization uses a central t curve for the null and the noncentral t-distribution for the alternative.
Blue curve: the null t-distribution (H0: no effect).
Green curve: the noncentral t density at the chosen standardized effect.
Red dashed line: the two critical values. The test rejects in either tail beyond them.
Green shaded area: the probability of rejecting H0 at the chosen effect.
Common mistakes
- Using “small/medium/large” effect sizes without domain context. Define the smallest effect of interest for your decision.
- Underestimating variance (σ) from pilot data. Check the required sample size across plausible standard deviations. With more noise than planned, actual power is lower than the planning calculation suggests.
- Reporting the original 80% power after reducing the sample. The 80% figure applies to the full planned sample. If you cut the sample to fit the budget, recalculate power for the sample you can afford and report that value. Acknowledge when the study is underpowered.
- Choosing the test direction after seeing results. Set the direction before data collection and use a two-sided analysis when departures in both directions matter.
- Computing “observed power” after a study using the observed effect size. Power calculated at the observed effect is circular and adds no information to the test. After a study, power at a prespecified effect can describe design sensitivity.
- Using z instead of t at small n can understate the required sample size.
Workflow
- Define your hypothesis type: two-sided difference, superiority, non-inferiority, or equivalence.
- Set α and power: typically α = 0.05, power = 0.80–0.90. Justify deviations based on error consequences.
- Define the smallest effect of interest (δ). Choose the smallest raw effect that would change your decision or justify the cost. Consult stakeholders.
- Estimate variance (σ): use pilot data, published literature, or conservative estimates.
- Calculate sample size: use our Calculator tab, or dedicated tools (G*Power, PASS) for more complex designs.
- Run a sensitivity analysis. Check how the required sample size changes across reasonable values of δ and σ. If small changes push it beyond your budget, the plan is fragile.