Power Analysis and Sample Size Calculator
Operator: Abdulla Al Fahad. How tools are built and checked
Power is the probability that a study will detect an effect of a given size, and it has to be planned before the data exist: a sample that is too small cannot tell a real effect from noise, and one that is too large wastes participants. The page solves three questions for eight tests: how many subjects, how much power, or what is the smallest effect a sample can detect. It shows the critical value, noncentrality and degrees of freedom behind each answer and draws the power curve.
To detect a medium difference, d = 0.5, between two groups at alpha 0.05 you need 64 people per group, and 64 gives a power of 80.15%. Asking for 90% power raises that to 86 per group, and for 95% to 105. Halve the effect to d = 0.2 and the same 80% power needs 394 per group.
Key features
- t-tests for one mean, paired differences and two independent means, one- or two-tailed, with an optional group size ratio
- One-way ANOVA with any number of groups, correlation, chi-square with the degrees of freedom you give, regression for all or some predictors, and two proportions by arcsine or pooled-normal methods
- Solve for sample size, power, or the smallest effect detectable at a target power
- Critical value, noncentrality and degrees of freedom displayed for every result, with a power curve against sample size or effect size, downloadable as CSV
- Sample sizes for the three Cohen benchmark effects at three power levels
What each test assumes and how the noncentral distribution gives power
No file is needed, and the page opens already filled in with the example below (two independent means, d = 0.5, solving for sample size), so there is nothing to load. Pick the test, the question to solve, alpha, and an effect size in that test's own units: Cohen's d for the t-tests, f for ANOVA, r for correlation, w for chi-square, f-squared for regression, or two proportions. Sample sizes are whole numbers; two-group tests count Group 1, with Group 2 set by a size ratio, and ANOVA counts per group. Searches go up to 1,000,000.
The effect-size helper turns a mean difference and a standard deviation into d, eta-squared into f, and R-squared into f-squared. The table of Cohen's small, medium and large benchmarks shows the sample size each would need at power 0.80, 0.90 and 0.95.
How it works
Power is the chance that the test statistic lands beyond its critical value when the true effect is not zero. For t-tests the statistic follows a noncentral t distribution, with noncentrality d times the square root of n (or of n1 n2 over n1 + n2 for two groups). For ANOVA and regression it follows a noncentral F with noncentrality f-squared times total N, and for chi-square a noncentral chi-square with noncentrality w-squared times N.
Each noncentral distribution is a Poisson mixture of ordinary ones, summed in log space over the range where the weights matter, on top of verified incomplete beta and gamma functions. The noncentral t uses Lenth's AS 243 algorithm. Correlation uses the Fisher z approximation with an optional bias term r / (2 (n - 1)); two proportions use Cohen's h or a pooled-variance z test.
Sample size is found by doubling n until the target power is met, then bisecting to the smallest whole n, and checking that n - 1 does not also meet it, since power can wobble slightly between neighbouring n as degrees of freedom change. The smallest detectable effect is found by bisection on the effect size at fixed n.
When to use it
- A trial planned at d = 0.5 and 80% power: 64 per group (128 in all), or 51 per group if a one-tailed test is justified.
- A 3-group ANOVA with f = 0.25: 53 per group (159 in total) for 80% power, 69 for 90%.
- A correlation study expecting r = 0.30: 84 participants with the bias correction on, 85 with it off.
- A chi-square test with w = 0.30 and 2 degrees of freedom: 108 observations; with 1 degree of freedom, 88.
- A regression with five predictors and f-squared = 0.15: 92 participants for the overall test.
Inputs
- Choose the test and what to solve for.
- Enter the effect size, or open the helper to convert a mean difference and SD, an eta-squared or an R-squared.
- Set alpha, target power or sample size, and the design details such as groups or predictors.
- Read the headline number and the critical value and noncentrality behind it.
Worked example
Two independent means, d = 0.5, alpha 0.05 two-tailed, target power 0.80, equal groups
Test: t-test, two independent means
Solve for: sample size
Effect size d: 0.5
Alpha: 0.05
Target power: 0.8Result
Group 1 size needed: 64 (64 + 64 = 128 in total)
Achieved power 80.15%
Critical t 1.9790 on 126 degrees of freedom
Noncentrality 2.8284
For power 0.90: 86 per group; for 0.95: 105Tips for best results
- Use the solve-for-effect mode after the fact. A sample of 64 per group has 80% power for d = 0.499, so a study with that sample cannot be said to rule out anything smaller than about d = 0.5.
- For correlation, leave the bias correction on when you want to match an exact bivariate-normal calculation; switch it off to match Cohen's printed tables, which give 85 for r = 0.30.
- For two proportions the arcsine and pooled methods agree at moderate rates (both give 170 per group for 65% against 50%) and part company near 0: 2% against 0.5% needs 776 per group by arcsine and 861 by the pooled method. Say which you used.
Limits
Power depends on the effect size you put in, which is a guess. An effect taken from a small published study is usually too large, so plan on a smaller one or on the smallest effect that would matter.
These are fixed-sample calculations for one primary test. They do not cover several comparisons, clustering, dropout, or unequal variances; inflate the sample for expected dropout and for a multiplicity correction yourself.
The ANOVA and chi-square effect sizes f and w describe the whole pattern, not a single contrast. A planned pairwise comparison needs the two-sample t-test with its own d.
Common errors and how to fix them
- Even a million per group does not reach that power. The effect is too small to detect.
- The effect size is tiny, such as d = 0.001. Enter a larger effect, or lower the target power.
- The two proportions are equal, so there is no difference to detect.
- Enter two different proportions, for example 0.65 and 0.50.
Reproducing G*Power's two-group case
The two-group example above reproduces the figures G*Power 3.1 prints for it: 128 in total, power 0.8014596, critical t 1.9789706, 126 degrees of freedom and noncentrality 2.8284271. The one-sample case at d = 0.5 gives 34 pairs, the 3-group ANOVA at f = 0.25 gives 159 in total, and chi-square at w = 0.30 gives 108 and 88 for 2 and 1 degrees of freedom, agreeing with the sample sizes G*Power 3.1 returns for the same inputs.
Choosing the effect size
Cohen's small, medium and large benchmarks are a fallback, not a target. The page tabulates them: for two means, d = 0.2 needs 394, 527 and 651 per group at power 0.80, 0.90 and 0.95; d = 0.5 needs 64, 86 and 105; d = 0.8 needs 26, 34 and 42. A better input is the smallest difference that would change a decision, expressed in the outcome's own units and divided by its standard deviation.
Reading the power curve
Power rises steeply at first and then flattens, so the last points are the expensive ones. In the two-group example, 50% power needs 32 per group; the next 30 points of power cost 32 more people (about one per point), the next 10 points cost 22 (2.2 per point) and the next 5 cost 19 (3.8 per point).
Frequently asked questions
How does this differ from the A/B test and survey sample size pages?
The A/B Test Significance Calculator here analyses results and has a planner for conversion tests, and the Survey Sample Size Calculator sizes a sample to estimate a percentage within a margin of error. This page plans hypothesis tests of eight kinds.
Why does the page report slightly more than 80% power for the sample it finds?
Sample size is a whole number, so the page returns the smallest n that reaches the target. With 64 per group the power is 80.15%, while 63 gives 79.5%.