Change language

Statistics

Statistical power and sample size calculator by test

How many participants do you need? Work out sample size for a t test, correlation, ANOVA, proportions or chi-square, or the power of the sample you have.

Published by SolucionesAhora.com How we verify

Calculator inputs

  1. Enter your figures, or press “See example” to watch it work.
  2. If your case is unusual, open “Advanced options”.
  3. Read the result and, below it, what it means and how it was worked out.

Pick the test you will analyse the data with. The sample size depends on it: a t test, a correlation and an ANOVA need different numbers to detect “the same” effect.

The smallest effect you would care to detect. It is measured with Cohen’s d for t tests (0.2 small, 0.5 medium, 0.8 large), r for correlation (0.1, 0.3, 0.5), f for ANOVA (0.1, 0.25, 0.4) and w for chi-square (0.1, 0.3, 0.5). Better to take it from earlier studies or from what would matter in practice than from the habit of using “medium”.

d, r, f or w depending on the test

The expected proportion in the first group, for example 0.40 if you expect a 40% response.

Between 0 and 1

The expected proportion in the second group. The gap from the first is the effect you want to detect.

Between 0 and 1

You can work out how many people you need to reach a power level, or the power your study would have with a sample you already have.

The probability of detecting the effect if it really exists. 80% is the habit; 90% or 95% are asked for when missing it would be costly.

The number of participants you have: per group for the independent t, ANOVA and proportions; pairs for the paired t and correlation; total for chi-square.

Per group, pairs or total

How many groups you compare in the ANOVA, from 3 to 20.

For ANOVA

In a contingency table it is (rows − 1) × (columns − 1); in a goodness of fit, categories − 1.

For chi-square

Advanced options

The risk you accept of calling an effect real when it is not. 5% is the habit. With several tests at once a stricter level is advisable.

With two tails you look for differences in either direction (the most common and the most cautious choice). With one tail only in the direction you predicted before seeing the data: it needs less sample but cannot detect the opposite effect.

If the second group is twice the size of the first, enter 2. With equal groups (1) the total sample is the smallest possible.

Group 2 ÷ group 1

See the result

Results

Sample size (per group or pairs)64
Total participants128
Power reached80.1%
Total at 80% power128
Total at 90% power172
Total at 95% power210
Effect size used0.500
See the working step by step
  1. Effect size used = 0.500
  2. Participants per group (or pairs) = 64
  3. Total participants = 128
  4. Power = 80.1% (risk of missing it: 0.20)
  5. At 80% power: 128 in total; at 90%: 172; at 95%: 210

In short

What it calculates
How many participants do you need? Work out sample size for a t test, correlation, ANOVA, proportions or chi-square, or the power of the sample you have.
Formula used
Power = probability that the statistic exceeds the critical value when the effect is real
Example
Example 1. A before-and-after (paired) design.

Statistical power and sample size calculator

Planning a study, a pre-registration or a grant proposal? You need to justify how many participants you will recruit. Too few and a real effect can slip through; too many and you waste time and money. That justification is a power analysis, and journals, funders and ethics committees increasingly expect it.

Pick the test you will use, the effect size you care to detect and the power you want. The calculator tells you how many participants you need and what power other sample sizes would give. Results match G*Power for the standard designs.

How it works

Power is the probability that your test detects an effect that really exists. It depends on four linked quantities: sample size, effect size, significance level (alpha) and power itself. Fix any three and the fourth is determined.

The calculator fixes the effect, alpha and the power you want and searches for the smallest sample that meets them, using the exact distribution of the test (noncentral t, noncentral F or noncentral chi-square). It can also run the other way: given your sample size, it tells you the power you have.

Formula

Power = probability that the statistic exceeds the critical value when the effect is real

t test: noncentrality δ = d × √(n1·n2 ÷ (n1 + n2)) (independent) or δ = d × √n (paired)
power = 1 − P(noncentral t ≤ critical t) + P(noncentral t ≤ −critical t) [two tails]
Correlation: z = atanh(r); power = Φ(|z| × √(n − 3) − critical z) + Φ(−|z| × √(n − 3) − critical z)
Proportions: h = 2·asin√p1 − 2·asin√p2; power = Φ(|h| × √(n ÷ 2) − critical z) + ...
ANOVA: λ = f² × N; power = 1 − P(noncentral F ≤ critical F)
Chi-square: λ = w² × N; power = 1 − P(noncentral χ² ≤ critical χ²)

Sample size = the smallest whole n whose power ≥ the target.

Worked example

Example 1. A before-and-after (paired) design.
You expect a medium effect (d = 0.5), alpha 0.05, two tails and 80% power. You need 34 pairs. At 90% power it would be 44 pairs, and at 95%, 54.

Example 2. Comparing two proportions.
You expect 40% of one group to respond and 55% of the other. Cohen’s h is 0.30. With alpha 0.05, two tails and 80% power you need 173 per group, 346 in total. At 90% power: 232 per group.

Explanation

What power means in practice

Statistical power is the probability of getting a significant result when the effect you are looking for really exists. 80% power means that, in 20% of studies like yours, the test would miss a real effect. With small samples that chance of missing is large, and the significant results that do turn up tend to exaggerate the effect.

What to put in a pre-registration or grant proposal

  • The test, the effect size, alpha and the power, and the resulting sample size.
  • A source for the expected effect: earlier studies or the smallest effect that would matter in practice.
  • A plan for attrition: if you expect to lose 15% of participants, recruit the calculated number divided by 0.85.

How to choose the effect size

This is the hardest decision and the one that moves the answer most. Reasonable sources: the smallest effect that would matter in your field, effects in similar studies (beware: published effects tend to be larger than true ones) and, only as a last resort, Cohen’s conventions (small, medium, large). Halving the effect size multiplies the required sample by four.

One or two tails, alpha and power

Two tails tests differences in either direction. One tail makes sense only if you had a clear directional prediction before seeing the data; it needs less sample but leaves the test blind to the opposite effect. Alpha of 5% and power of 80% are habits, not laws: a high-stakes study may ask for 1% and 90%.

Common mistakes

  • Calculating power after the results using the observed effect: it adds no information, as it is determined by the p value.
  • Using “medium effect” without checking it is what you actually care about.
  • Forgetting attrition.
  • Not adjusting alpha when running several tests.
  • Mixing per-group sample sizes with totals: the calculator reports both.

Limits of this calculator

  • It covers simple designs: two independent groups with equal variances, one-way ANOVA with equal group sizes, a correlation, two proportions and Pearson’s chi-square. It does not cover repeated-measures designs with several factors, mixed models, multiple regression or survival analysis.
  • For correlation it uses Fisher’s transformation, which is approximate: with r = 0.30 it gives 85 pairs, while the exact calculation gives 84.
  • For two proportions it uses Cohen’s h, a normal approximation; with proportions near 0 or 1 an exact method is better.
  • For chi-square, the effect w is defined from the expected proportions in the table; this calculator does not derive it for you.
  • Power is conditional on the effect being the one you assumed. If the true effect is smaller, so is the true power.

Notice

This is an estimate and does not replace the sample-size justification a funder, ethics committee or journal requires. Check the calculation with G*Power or a statistician before recruiting.

Frequently asked questions

What is statistical power?

The probability that a test detects an effect when it really exists. 80% power means that if the effect is the expected one, the test comes out significant 8 times out of 10.

How many participants do I need per group for a t test?

For a medium effect (d = 0.5), alpha 0.05, two tails and 80% power you need 64 per group. For a small effect (d = 0.2) you would need 394 per group.

What effect size should I use?

The smallest one that would matter in practice, or one from similar earlier studies. Cohen’s conventions should be the last resort.

Why 80% power?

It is a historical habit that balances the risk of missing the effect with the cost of recruiting more people. It is not a rule: you can ask for 90% or 95%.

One tail or two?

Two tails is standard and the most cautious. One tail only if you had a directional prediction before seeing the data and the opposite effect does not interest you.

Can I calculate power after the study?

It is of little use: “observed power” is tied to the p value and adds no information. Better to calculate power a priori or report a confidence interval.

How do I allow for dropouts?

Divide the calculated sample size by the proportion you expect to keep. If you expect to lose 20%, divide by 0.80.

Does it match G*Power?

Yes, for t tests, ANOVA and chi-square it uses the same noncentral distributions. For correlation G*Power uses an exact method that can give one fewer than Fisher’s transformation.

Sources and references

The formula behind this calculator is not ours. These are the sources it comes from, in APA 7 format, in case you want to go to the original or cite them in your own work.

  1. Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2.ª ed.). Lawrence Erlbaum Associates. The reference text: the effect sizes d, r, f, w and h and their conventional values.
  2. Faul, F., Erdfelder, E., Lang, A.-G., & Buchner, A. (2007). G*Power 3: A flexible statistical power analysis program for the social, behavioral, and biomedical sciences. Behavior Research Methods, 39(2), 175–191. https://doi.org/10.3758/BF03193146 https://doi.org/10.3758/BF03193146 The reference program these figures are checked against: for example 64 per group in a t test with d = 0.5.
  3. Lakens, D. (2022). Sample size justification. Collabra: Psychology, 8(1), Artículo 33267. https://doi.org/10.1525/collabra.33267 https://doi.org/10.1525/collabra.33267 A current guide to justifying sample size and choosing the smallest effect of interest.

Need to calculate something else?

These tools are often used alongside this calculator.

Sample size

How many responses you need to estimate a percentage or a mean, with finite population, design effect and…

Cohen’s d

Effect size between two groups or before and after, with confidence intervals, plain-language equivalents…

t-test

Compare two means (independent or paired) or one mean with a value, with p value, confidence interval and…

Chi-square

Chi-square test for contingency tables and goodness of fit, with Cramér’s V, residuals, Yates’ correction…

Pearson correlation

Pearson’s r between two variables, with p value, confidence interval, regression line and scatter plot.