Sample size

Sample size calculator for Pearson correlation

Calculate how many pairs of observations you need to detect a minimum significant correlation.

Calculate how many pairs of observations you need for a Pearson correlation test to detect, with the target power, a minimum nonzero correlation. It is based on Fisher's \(z\) transformation.

Calculator

Enter the minimum correlation to detect, alpha, power and the type of test.

Result pending…

Explanation

This calculation determines how many pairs of observations (n) are needed to detect a population correlation \(\rho\) different from zero with a given power and significance level. The logic differs from the mean or proportion calculators: here we use Fisher's z transformation, which stabilizes the variance of \(\hat{\rho}\).

The sample estimator \(\hat{\rho}\) (Pearson correlation) has a skewed, asymmetric distribution when \(\rho \neq 0\), with variance that depends on \(\rho\) itself. The transformation \(z = \operatorname{arctanh}(\hat{\rho})\) converts this distribution into an approximately normal one with variance \(1/(n-3)\), independent of \(\rho\). This allows n to be derived directly from the signal-to-noise ratio.

Sample size formula

Let \(z_\rho = \operatorname{arctanh}(\rho) = \frac{1}{2}\ln\!\left(\frac{1+\rho}{1-\rho}\right)\). Then:

\( n = \left\lceil \frac{(Z_{\alpha/2} + Z_\beta)^2}{z_\rho^2} \right\rceil + 3 \)

where \(Z_{\alpha/2}\) is the normal quantile for a two-tailed test (or \(Z_\alpha\) for a one-tailed test) and \(Z_\beta = \Phi^{-1}(1-\beta)\).

  • ρ: minimum correlation of interest (in absolute value). The sign does not matter for the sample size.
  • zρ: the arctanh transformation acts as the "standardized effect"; small correlations produce small zρ and large n.
  • +3: standard correction derived from the exact distribution of \(\hat{\rho}\); it improves the approximation for small n.
  • Reference (Cohen, 1988): ρ = 0.10 (small), 0.30 (moderate), 0.50 (large).

Quick setup

  • Unknown ρ: use ρ = 0.30 as a conservative reference for a moderate effect.
  • Two-tailed test: use when you have no prior directional hypothesis.
  • One-tailed test: only if you have solid reasons to expect a positive (or negative) correlation — it reduces n but requires a priori justification.
  • Power: 0.80 is the usual minimum; 0.90 for confirmatory studies or psychometric validation.

Simple example

You want to detect a correlation of at least ρ = 0.30 with α = 0.05 two-tailed and power 0.80. The transformation gives zρ = arctanh(0.30) ≈ 0.3095. You need approximately 85 pairs of observations.

Worked example

An educational research team wants to study whether there is a correlation between weekly hours of independent study and the grade obtained on the final exam. Based on prior literature, they estimate the population Pearson correlation to be \(\rho \approx 0.40\) (moderate correlation). The test is two-tailed with \(\alpha = 0.05\) and a power of 80% is desired to detect correlations of magnitude \(\rho \geq 0.40\).

The first step is to apply Fisher's transformation \(z_r\) to stabilize the variance:

\( z_r = \frac{1}{2} \ln\!\left(\frac{1 + \rho}{1 - \rho}\right) = \frac{1}{2} \ln\!\left(\frac{1.40}{0.60}\right) = \frac{1}{2} \ln(2.333) = \frac{1}{2} \times 0.8473 \approx 0.424 \)

With \(z_{\alpha/2} = 1.960\) and \(z_{\beta} = 0.842\), the sample size is obtained as:

\( n = \frac{(z_{\alpha/2} + z_{\beta})^2}{z_r^2} + 3 = \frac{(1.960 + 0.842)^2}{(0.424)^2} + 3 = \frac{7.851}{0.1798} + 3 \approx 43.7 + 3 = 46.7 \)

Rounding up to the nearest integer, 47 participants are needed to achieve 80% power to detect \(\rho = 0.40\) with \(\alpha = 0.05\) two-tailed.

If the expected correlation were weaker, say \(\rho = 0.25\), Fisher's transformation would give \(z_r = 0.5 \times \ln(1.25/0.75) \approx 0.5 \times 0.5108 = 0.2554\). In that case:

\( n = \frac{7.851}{(0.2554)^2} + 3 = \frac{7.851}{0.0652} + 3 \approx 120.4 + 3 = 124 \)

124 participants would be needed, almost triple the requirement for \(\rho = 0.40\). This comparison illustrates the high sensitivity of the sample size to the expected correlation value, especially in the range \(\rho < 0.30\).

Model assumptions

  • Bivariate normality: the formula assumes that (X, Y) follows a bivariate normal distribution. Severe deviations affect the distribution of \(\hat{\rho}\).
  • Independence: each pair (xi, yi) is independent of the others.
  • Linear relationship: Pearson correlation measures only linear association; a strong curvilinear relationship with ρ ≈ 0 would not be detected.
  • Absence of influential outliers: outliers can seriously distort \(\hat{\rho}\); this is especially relevant in small samples.

Common uses

  • Validation of psychometric scales and questionnaires (item-total correlation, test-retest reliability).
  • Association studies between two continuous variables (biomarkers, clinical scales, physiological parameters).
  • Inter-observer agreement analysis using Pearson or intraclass correlation.
  • Validation studies of measurement methods (e.g., comparison of two laboratory techniques).

How to interpret the result

The value \(n\) is the minimum number of pairs of observations (subjects with both required measurements) needed to detect a Pearson correlation \(\rho_1\) when the null hypothesis is \(\rho = \rho_0\) (usually \(\rho_0 = 0\)) with the specified power and significance level. Always round up. If you expect that some subjects will not be measurable on both variables (loss to follow-up, missing data), divide \(n\) by \((1 - \text{loss rate})\) to obtain the required recruitment number.

The formula uses Fisher's \(z\) transformation \(z = \frac{1}{2}\ln\!\left(\frac{1+\rho}{1-\rho}\right)\) to stabilize the variance. This transformation is more accurate when \(n \geq 10\) and \(|\rho| < 0.9\); for very high correlations (\(|\rho| > 0.9\)) the approximation may underestimate the required \(n\). Perform a sensitivity analysis by varying \(\rho_1\) by ±0.10: an expected correlation of 0.5 instead of 0.6 may require 40–60% more pairs. If the actual correlation turns out to be larger than expected, the test will have more power than planned (generally good news), but if it turns out to be smaller, the study may end up underpowered.

When the calculated \(n\) is very small (< 20 pairs), verify that the relationship between the variables is reasonably linear and that there are no influential outliers, since Pearson correlation is sensitive to both factors. If the data show nonlinearity or heavy tails, consider Spearman correlation and adjust \(n\) with a relative efficiency factor. Once the data are collected, calculate the correlation and its CI with the hypothesis test calculator for correlation or run the formal test with the corresponding tool.

External references

Frequently asked questions

  • What is Fisher's z transformation? z = arctanh(ρ) = ½·ln((1+ρ)/(1−ρ)); it converts the skewed distribution of r̂ into an approximately normal one with variance 1/(n−3), which allows the normal approximation to be used to derive n directly.
  • Negative correlation? The magnitude |ρ| is what determines the sample size; the direction (positive or negative) does not affect n, although it does affect the type of test (use a one-tailed test if you have a directional hypothesis).
  • What's the difference between two-tailed and one-tailed? Two-tailed (H₁: ρ ≠ 0) uses Z_{α/2} and is appropriate when you have no prior hypothesis about the sign. One-tailed (H₁: ρ > 0) uses Z_α and gives a slightly smaller n, but requires a priori justification.
  • Does it work for Spearman or tau correlation? Fisher's formula is strictly valid for Pearson correlation with bivariate normality. For Spearman it can be used as an approximation, though with less precision.
  • Is the sample size exact? It is an approximation; it works well for n > 20. For very small n, exact methods (simulation or power tables) are more precise.