Sample size calculator (power analysis)
For a two-sample t test with a medium effect (Cohen’s d = 0.5), α = 0.05 two-sided and 80% power you need 64 participants per group, 128 in total. Choose the test (two-sample t, paired t, two proportions, one-way ANOVA or correlation), enter the expected effect as an effect size or as means and SDs, proportions or group means, and set α, power, one- or two-sided and the allocation ratio. The calculator gives the smallest sample size that reaches the target power, or the power of a sample size you already have, with a power curve. t tests use the exact noncentral t distribution, the same calculation as G*Power and R’s pwr.t.test.
- What it does
- Finds the sample size for a target power (or the power for a given n) for t tests, two proportions, one-way ANOVA and correlation.
- Formula
- Example
- d = 0.5, α = 0.05 two-sided, power 0.8: n = 64 per group (ν = 126, δ = 2.828, power 0.8015); with 63 per group power is 0.7952.
Last updated
Loading Sample size calculator…
At a glance
| Tests | Two-sample t, paired/one-sample t, two proportions, one-way ANOVA, correlation |
|---|---|
| Solves for | Sample size (smallest whole n) or power |
| Distributions | Exact noncentral t (AS 243) and noncentral F; normal approximation for proportions; Fisher z for correlation |
| Options | |
| Check | |
| Output | n per group and total, achieved power, critical value, noncentrality, power curve |
| Runs in | Your web browser; nothing is uploaded |
| Price | Free, no account needed |
What it does
How to use the sample size calculator
- Choose the testPick the analysis you will run: two-sample t, paired t, two proportions, one-way ANOVA or correlation, and whether to solve for n or for power.
- Enter the expected effectType an effect size (
, , or ) or the expected means and SDs, proportions or group means from a pilot study or the literature. - Set α and powerUsually
two-sided and power 0.8 or 0.9; read off the sample size, the power curve and the sentence for your protocol.
How it works
t tests (exact). Under the alternative, the t statistic follows a noncentral t distribution with
and one-sided power drops the last term and uses pt). When entering means and SDs,
One-way ANOVA. With
computed as a Poisson-weighted sum of incomplete beta functions. This is the convention of G*Power and R’s pwr.anova.test.
Two proportions. The normal approximation with the pooled proportion
The optional continuity correction is that of Fleiss, Tytun and Ury (1980):
Correlation. The Fisher z approximation used by R’s pwr.r.test: the critical
Sample size is the smallest whole
Checks. The distribution functions agree with SciPy’s nct and ncf to at least 10 significant figures.
Sources: Cohen J. Statistical Power Analysis for the Behavioral Sciences, 2nd ed. Hillsdale, NJ: Lawrence Erlbaum; 1988 (reissued by Routledge, doi:10.4324/9780203771587). Faul F, Erdfelder E, Lang A-G, Buchner A. G*Power 3: a flexible statistical power analysis program for the social, behavioral, and biomedical sciences. Behav Res Methods 2007;39:175–191, doi:10.3758/BF03193146. Lenth RV. Algorithm AS 243: cumulative distribution function of the non-central t distribution. Appl Stat 1989;38:185–189, doi:10.2307/2347693. Fleiss JL, Tytun A, Ury HK. A simple approximation for calculating sample sizes for comparing independent proportions. Biometrics 1980;36:343–346, doi:10.2307/2529990.
Worked examples: t test, ANOVA and two proportions
Two-sample t test. You expect treated cells to differ from controls by half an SD (
- One-sided instead: 51 per group.
- Power 0.9 instead of 0.8: 86 per group.
- Twice as many in group 2 (ratio 2):
, (power 0.8021). - With only 20 per group, power is 33.8%.
| Test | Small | Medium | Large |
|---|---|---|---|
| Two-sample t ( | 394 | 64 | 26 |
| Paired t ( | 199 | 34 | 15 |
| One-way ANOVA, 3 groups ( | 323 | 53 | 22 |
| Correlation ( | 782 | 85 | 29 |
One-way ANOVA. Three groups with
Two proportions. A response rate of 65% with the standard treatment and 85% expected with the new one,
Frequently asked questions
How do I calculate sample size for a t test?
Decide the smallest difference worth detecting and the SD you expect, and divide to get Cohen’s
What sample size do I need for 80% power?
It depends on the effect size: for a two-sample t test at
What is Cohen’s d and how do I estimate it?
Should I use a one-sided or two-sided test?
Two-sided, unless a difference in the other direction would be of no interest and you decided this before collecting data. A one-sided test needs fewer participants (51 instead of 64 per group for
Does this give the same answer as G*Power?
For t tests and one-way ANOVA it uses the same exact noncentral t and F distributions, so the sample sizes match: 64 per group for
How do I account for dropouts?
Divide the calculated sample size by the proportion you expect to complete. For 64 per group and 15% dropout, recruit
What is the difference between power and α?
How many animals or replicates do I need per group?
Use the same calculation with the effect you expect relative to the variability between animals or replicates. For a large effect (
Link to this tool
Using it in a protocol, lab wiki or course page? Copy a link or citation.
<a href="https://www.labcanvas.com/tools/sample-size-calculator">Sample size calculator</a> (LabCanvas)LabCanvas. Sample size calculator [online tool]. https://www.labcanvas.com/tools/sample-size-calculatorAnalyse the data when it arrives
The LabCanvas Graphs app runs t tests, ANOVA and correlations and draws the figure with the statistics on it.
Open the Graphs app