Sample Size and Power Analysis Tutorial: A Priori, Post Hoc and Sensitivity with a Free Calculator
Sample size and power analysis tells you how many participants a study needs, or how much power a given sample has, before you collect data. This tutorial walks through the StatFas sample size and power analysis calculator exactly as it works: choose the test, set α, power and the effect size, run an a priori, post hoc or sensitivity analysis, read the tables and power figure, and report the result in APA 7.
Click here to do free sample size and power analysisWhat the calculator gives you
- Sample size, power or the smallest detectable effect for 12 kinds of analysis, all running in your browser: independent, paired and one-sample t tests, one-way ANOVA, repeated-measures ANOVA, correlation, chi-square, two proportions, logistic regression, multiple regression (R² and R² change), mediation and SEM/CFA.
- Three types of analysis: a priori (sample size for a target power), post hoc (power for a given sample size) and sensitivity (smallest detectable effect).
- An optional allowance for expected attrition, which inflates the number you need to recruit.
- APA 7 input and result tables, a sample-size-by-power table, a written power analysis paragraph with a reference line, and a figure of the null and alternative distributions.
- A validation panel that recomputes benchmark cases against G*Power.
Before you start
- Know the statistical test you will use for your primary hypothesis. Power depends on that test, not on the number of questionnaire items. If you sum items into a scale score, choose the test for that score (a t test or ANOVA to compare groups, a correlation for an association, or multiple regression for several predictors).
- Decide the smallest effect size of interest: the smallest effect that would still matter in practice. Published estimates from meta-analyses or closely related studies are the next best source. Use Cohen's small, medium and large benchmarks only as a fallback.
- Choose α (usually .05) and the target power (.80 at minimum; .90 or .95 is common in clinical trials).
- Estimate the dropout or unusable-data rate so you can recruit enough people.
Step 1: Choose the analysis
In 1. Choose the analysis, open the Test list and pick the test that matches your design:
- Independent-samples t test (two means)
- Paired-samples t test
- One-sample t test
- One-way ANOVA
- Correlation (Pearson r)
- Chi-square test
- Two proportions (z test)
- Logistic regression (odds ratio)
- Repeated-measures ANOVA (within-subjects)
- Mediation (indirect effect, Monte Carlo)
- SEM / CFA (RMSEA power)
- Multiple regression / R² change (F test)
The form then shows only the fields that test needs.
Step 2: Choose the type of analysis and the tails
| Type of analysis | You enter | You get | Use it when |
|---|---|---|---|
| A priori: sample size for target power | α, target power, effect size | Required sample size | Planning a study |
| Post hoc: power for a given sample size | α, sample size, effect size | Power | Checking a design with a planned or hypothesised effect |
| Sensitivity: smallest detectable effect | α, target power, sample size | Smallest effect you can detect | The sample is fixed by resources or an existing dataset |
Then choose Two-tailed (the default for most studies) or One-tailed. Use one-tailed only when you committed to a direction before seeing any data.
Caution about post hoc power: use it with a planned or meaningful effect, not with the effect you observed in a finished study. Observed power adds nothing beyond the p-value; for a non-significant result, report the effect size with its confidence interval instead.
Step 3: Set α, power and the effect size
Enter the significance level α (.05 by default) and the target power (1 − β). For the effect size, type your value, or use the Small, Medium and Large buttons to insert Cohen's (1988) benchmark. The benchmarks for each test are:
| Test | Effect size | Small | Medium | Large |
|---|---|---|---|---|
| t tests | Cohen's d | 0.20 | 0.50 | 0.80 |
| One-way ANOVA | Cohen's f | 0.10 | 0.25 | 0.40 |
| Correlation | r | .10 | .30 | .50 |
| Multiple regression | f² | 0.02 | 0.15 | 0.35 |
| Chi-square | w | 0.10 | 0.30 | 0.50 |
For an independent t test you can instead enter the expected mean difference and the standard deviation and press Use as Cohen's d to convert them. For multiple regression, enter the expected R² and press Convert R² to f².
Step 4: Fill in the test-specific inputs
| Test | What else you enter |
|---|---|
| Independent-samples t test | Allocation ratio (group 2 ÷ group 1; 1 means equal groups); optional rank-based option |
| Paired and one-sample t test | Effect size d; optional rank-based option |
| One-way ANOVA | Effect size f and the number of groups |
| Correlation (Pearson r) | The expected correlation r |
| Chi-square test | Effect size w and the degrees of freedom, or the table rows and columns (use 1 column for goodness of fit; df is then set automatically) |
| Two proportions (z test) | Proportion in group 1, proportion in group 2, and the allocation ratio |
| Logistic regression | Odds ratio per 1 SD of a normal predictor, the event rate at the predictor mean P(Y = 1), and the R² of the predictor with the other predictors |
| Repeated-measures ANOVA | Effect size, measurements per person, the correlation between measurements and the nonsphericity correction ε |
| Mediation | Standardised paths a (X→M), b (M→Y) and c′ (direct). Power is simulated for the joint-significance test with 2,000 Monte Carlo replications, so results vary by about ±1% in power |
| SEM / CFA | Model df (or press Compute df from the observed variables and free parameters), the null RMSEA (0 = exact fit, .05 = close fit), the number of observed variables (items) and the free parameters |
| Multiple regression / R² change | Predictors tested (q), total predictors in the model (p) and f² or R². Use q = p for the overall model; q < p tests the R² change of q predictors |
The rank-based option adds about 5% to the sample size so you can plan a Mann–Whitney or Wilcoxon test.
Step 5: Allow for attrition and calculate
Enter the expected attrition / dropout %. The calculator inflates the recruited sample so that enough people remain after dropout. For example, 15% attrition turns 64 per group into 76 per group (64 ÷ 0.85 = 75.3, rounded up). Then press Calculate sample size / power.
Step 6: Read the results
| Output | What it shows | What to check |
|---|---|---|
| Input table | Every assumption you entered, in APA 7 style | That the test, α, tails and effect size are what you intended |
| Result table | Required sample size (per group and total), achieved power, or the smallest detectable effect | Whole participants, rounded up, plus the attrition-adjusted number |
| Sample size by power table | How the required sample changes with the power you target | The cost of moving from .80 to .90 or .95 |
| Power figure | The null and alternative distributions, the critical value, the Type I (α) and Type II (β) areas, and a red, amber or green bar for underpowered, appropriately powered and overpowered designs | It is a normal-approximation schematic for communicating power, not the exact calculation |
| APA 7 paragraph | A written power analysis and a reference line | Edit the wording to match your study |
The calculator searches for the smallest whole sample size that reaches your target power, using noncentral t-based power for t tests and an exact Poisson-mixture calculation for F and χ² tests. Logged-in users can download the tables and text as a Word file from the main website.
Worked example: two-group comparison
Suppose you plan to compare two independent groups and the smallest effect that matters is a medium one.
- Test: Independent-samples t test (two means); type: A priori; tails: Two-tailed.
- α = .05, target power = .80, effect size d = 0.50 (press Medium), allocation ratio = 1.
- Calculate. You should get about 64 participants per group (N = 128). A difference of one participant from G*Power can occur because G*Power uses the exact distribution and this tool uses an approximation.
- Add 15% expected attrition: recruit about 76 per group (N = 152).
Sensitivity version: if you can only recruit 50 per group, choose Sensitivity, keep α = .05 and power = .80, and enter 50 per group. The smallest detectable effect is about d = 0.57. Post hoc version: with 30 per group and d = 0.50, power is only about .48.
Step 7 (optional): Validate against G*Power
The Validation against G*Power section lists benchmark cases from published or G*Power results (two-tailed, α = .05, power = .80). Press Run validation to recompute them in your browser and compare. A one-participant difference is expected where G*Power uses an exact distribution and this tool uses an approximation.
Step 8: Report it in APA 7
A complete report names the test, α, tails, target power, effect size and where it came from, the result, the software and the attrition allowance. For the example above:
An a priori power analysis for an independent-samples t test was
conducted using StatFas. With α = .05 (two-tailed), power = .80 and a
smallest effect size of interest of d = 0.50, 64 participants per group
(N = 128) were required. Allowing for 15% attrition, 76 participants per
group (N = 152) were recruited.
The calculator also produces this paragraph automatically; check every number against the tables before you paste it.
Assumptions and limits
- A power analysis is only as good as its inputs. Effect sizes taken from one small pilot study tend to be inflated, so prefer the smallest effect of interest or a meta-analytic estimate.
- It assumes the test's own assumptions hold (for example roughly normal data and equal variances for the t test).
- It plans for one primary test. If you will test several outcomes or subgroups, use a stricter α or a larger sample, and note that tests of interactions usually need larger samples than main effects.
- Mediation power is simulated, so repeated runs vary slightly.
- The power figure is a schematic. Rely on the tables for the actual numbers.
Related tutorials and tools
- Independent t-test tutorial and One-way ANOVA tutorial: the analyses most power calculations are done for.
- Correlation tutorial, Linear regression tutorial and Logistic regression tutorial.
- Chi-squared test tutorial.
- Mediation tutorial and SEM tutorial.
Background reading: Sample Size and Power Analysis Explained (blog), which also shows how to do the same calculations in R, Python, G*Power and SPSS.
Click here to do free sample size and power analysis