Answer
How do you calculate the sample size needed to detect a correlation?
The short answer
Convert the correlation you want to detect to Fisher's z, z = atanh(r), then use n = ((z for alpha + z for power) / z)² + 3 and round up. For a two-sided test at α = .05 with 80% power, that gives 783 people for r = .1, 85 for r = .3 and 30 for r = .5. The hard part is not the arithmetic but choosing a realistic r.
The formula in one line
To plan a study that tests whether a Pearson correlation differs from zero, you need three inputs: the smallest correlation you care about detecting (r), the significance level (α, usually .05, two-sided) and the power you want (usually 80% or 90%). The standard approximation, based on Fisher's z transformation, is:
n = ((z_alpha + z_beta) / atanh(r))^2 + 3
Here atanh(r) is Fisher's z, which equals ½ ln((1 + r) / (1 − r)); z_alpha is the normal quantile for your significance level (1.96 for a two-sided test at α = .05); and z_beta is the normal quantile for your power (0.84 for 80%, 1.28 for 90%). Always round the result up to the next whole person.
The formula works because the sample correlation itself has an awkward, skewed sampling distribution, but its Fisher z is close to normal with a standard error of 1/√(n − 3) whatever the true correlation. That turns the problem into the familiar one for a normal mean: the expected z has to sit far enough from zero, measured in standard errors, to clear the critical value with the chosen probability.
A worked example, step by step
Suppose earlier work suggests a correlation of about .30 between two measures, and you want 80% power for a two-sided test at α = .05.
- Transform the correlation. atanh(0.30) = 0.3095.
- Add the two normal quantiles. 1.960 + 0.842 = 2.802.
- Divide and square. (2.802 / 0.3095)² = 81.93.
- Add 3 and round up. 81.93 + 3 = 84.93, so you need 85 complete pairs of observations.
Plan for missing data on top of that: if you expect 10% of participants to drop out or skip a measure, recruit 85 / 0.9, which is about 95. For a one-sided test, replace 1.960 with 1.645; only do that if a correlation in the other direction would genuinely be treated the same as a null result, and decide it before you see the data.
Sample size table for r = .1, .3 and .5
The R code below applies the formula to Cohen's conventional small, medium and large correlations, then checks two of the answers by simulation: it draws 10,000 samples of the planned size from a population with the target correlation and counts how often cor.test() gives p < .05. The Python tab does the same with NumPy and SciPy.
R
set.seed(2026)
# Sample size to detect a correlation r (two-sided test of rho = 0), Fisher z method
n_for_r <- function(r, power, alpha = 0.05) {
z_alpha <- qnorm(1 - alpha / 2) # 1.96 for alpha = .05
z_beta <- qnorm(power) # 0.84 for 80% power, 1.28 for 90%
ceiling(((z_alpha + z_beta) / atanh(r))^2 + 3)
}
r_values <- c(0.1, 0.3, 0.5)
table_n <- rbind(power_80 = sapply(r_values, n_for_r, power = 0.80),
power_90 = sapply(r_values, n_for_r, power = 0.90))
colnames(table_n) <- paste0("r=", r_values)
table_n
# Approximate power at a given n (same formula, solved the other way)
power_approx <- function(r, n, alpha = 0.05) {
pnorm(atanh(r) * sqrt(n - 3) - qnorm(1 - alpha / 2))
}
# Simulation check: draw samples with true correlation r and run cor.test()
sim_power <- function(r, n, reps = 10000) {
hits <- replicate(reps, {
x <- rnorm(n)
y <- r * x + sqrt(1 - r^2) * rnorm(n)
cor.test(x, y)$p.value < 0.05
})
mean(hits)
}
check <- sapply(c(0.3, 0.5), function(r) {
n <- n_for_r(r, 0.80)
c(r = r, n = n, formula = power_approx(r, n), simulated = sim_power(r, n))
})
round(t(check), 3)
Python
import math
import numpy as np
from scipy import stats
rng = np.random.default_rng(2026)
# Sample size to detect a correlation r (two-sided test of rho = 0), Fisher z method
def n_for_r(r, power, alpha=0.05):
z_alpha = stats.norm.ppf(1 - alpha / 2) # 1.96 for alpha = .05
z_beta = stats.norm.ppf(power) # 0.84 for 80% power, 1.28 for 90%
return math.ceil(((z_alpha + z_beta) / np.arctanh(r)) ** 2 + 3)
r_values = [0.1, 0.3, 0.5]
for power in (0.80, 0.90):
print(f"power_{int(power * 100)}", {f"r={r}": n_for_r(r, power) for r in r_values})
# Approximate power at a given n (same formula, solved the other way)
def power_approx(r, n, alpha=0.05):
return stats.norm.cdf(np.arctanh(r) * np.sqrt(n - 3) - stats.norm.ppf(1 - alpha / 2))
# Simulation check: draw samples with true correlation r and test it (same t test as cor.test)
def sim_power(r, n, reps=10000):
x = rng.normal(size=(reps, n))
y = r * x + np.sqrt(1 - r**2) * rng.normal(size=(reps, n))
xc = x - x.mean(axis=1, keepdims=True)
yc = y - y.mean(axis=1, keepdims=True)
r_hat = (xc * yc).sum(axis=1) / np.sqrt((xc**2).sum(axis=1) * (yc**2).sum(axis=1))
t = r_hat * np.sqrt((n - 2) / (1 - r_hat**2))
p = 2 * stats.t.sf(np.abs(t), n - 2)
return float(np.mean(p < 0.05))
for r in (0.3, 0.5):
n = n_for_r(r, 0.80)
print(f"r={r} n={n} formula={power_approx(r, n):.3f} simulated={sim_power(r, n):.3f}")
r=0.1 r=0.3 r=0.5
power_80 783 85 30
power_90 1047 113 38
r n formula simulated
[1,] 0.3 85 0.800 0.802
[2,] 0.5 30 0.814 0.832
These figures come from one seeded run of the R code. The table involves no randomness, so Python gives the same sample sizes; its simulated power differs slightly because its random numbers differ from R's, but the pattern is the same.
- Small correlations are expensive. Detecting r = .1 with 80% power takes 783 people, and 1,047 for 90% power. Halving the correlation roughly quadruples the sample, because n depends on the square of z.
- Medium and large correlations are cheap by comparison. r = .3 needs 85 (80% power) or 113 (90%); r = .5 needs 30 or 38.
- The simulation agrees. At n = 85 and a true correlation of .3, 80.2% of simulated studies were significant, against 80.0% from the formula.
- The approximation is slightly cautious for large r. At n = 30 and a true correlation of .5, the formula promises 81.4% power, and the simulation found 83.2%. The extra margin comes partly from rounding up and partly from the approximation itself, so for large correlations an exact calculation may need one or two fewer people. That error is on the safe side.
Choosing the correlation to plan for
The formula is only as good as the r you feed it, and that choice moves the answer far more than the choice between 80% and 90% power.
- Plan for the smallest correlation that would matter, not the one you hope to find. If a correlation of .2 would still change a decision or a theory, plan for .2.
- Be wary of a single published estimate. Published correlations from small studies tend to be inflated, because results that happened to come out large were more likely to reach significance and be reported. Shrink them, or use the lower end of a confidence interval.
- Allow for measurement error. Unreliable measures weaken the observed correlation, so the correlation you can expect to see is smaller than the correlation between the underlying traits.
- Testing against a value other than zero (for example, whether ρ exceeds .3) uses the same idea with the difference atanh(ρ₁) − atanh(ρ₀) in the denominator.
If your goal is to estimate the correlation precisely rather than to test it against zero, plan for the width of the confidence interval instead: on the z scale the 95% interval is roughly ±1.96/√(n − 3), so an interval of ±0.1 on that scale needs about 388 people regardless of the correlation's size. Power for other designs is covered on our page on whether a t test needs a minimum sample size, and the DASS tools page has calculators if you prefer not to code it.
How to report a sample size calculation in APA style (7th edition)
In the method section, give every input someone would need to repeat the calculation: the target correlation and where it came from, α, sidedness, power, the method or software, and the resulting n. Using the worked example:
"An a priori power analysis based on Fisher's z approximation indicated that 85 participants were needed to detect a correlation of r = .30 with 80% power in a two-sided test at α = .05. The target correlation was taken from [source]. Allowing for 10% attrition, we aimed to recruit 95 participants."
In the results, report the observed correlation with its degrees of freedom and confidence interval, for example r(83) = .xx, 95% CI [LL, UL], p = .xxx, so readers can see how precisely it was estimated.
Related tools and guides
- Correlation power and sample size calculator
- APA 7 formatter for correlations
- Power and sample size calculators
- Which statistical test should I use?
- Does a t test need a minimum sample size?
- DASS statistics tools and calculators
- Fisher transformation (Wikipedia)
More answered questions
- How are alpha and beta (Type I and Type II error rates) related?
- Does a t test need a minimum sample size?
- Pearson or Spearman correlation: which should you use?
Working with your own data?
General answers only go so far. Send us your situation and we'll reply by email within two business days.
Ask your questionWritten by AskStats with AI assistance. This is general information, not advice for your specific data or study. When the results matter, check your approach with a qualified statistician.