When to use it
Run a sample-size calculation before you collect data, as part of designing a study or A/B test. It turns a vague “how many do I need?” into a defensible number and protects you from an underpowered study that cannot detect the effect you care about.
The inputs explained
- Effect size — the smallest difference worth detecting (e.g. Cohen's d, or a proportion change). This is the hardest input; base it on prior studies or a pilot. See effect size explained.
- Power (1−β) — the probability of detecting a true effect; 0.80 is standard, 0.90 for high-stakes work.
- Significance level (α) — the false-positive rate you tolerate, usually 0.05.
- One- vs two-sided — two-sided is the safe default.
Worked example
To detect a medium effect (d = 0.5) between two groups with 80% power at α = 0.05 (two-sided), you need roughly 64 per group. Halving the effect to d = 0.25 roughly quadruples the requirement. Enter your targets above to get the exact number.
Common mistakes
- Post-hoc power — computing power after a null result adds nothing; plan power in advance.
- Guessing the effect size optimistically — inflated effect sizes produce samples that are too small.
- Forgetting attrition — inflate the target to cover dropout and unusable responses.
- Confusing the two error types — α is the false positive, β the false negative; see Type I & II errors.