Statistics and research

Correlation coefficient calculator

Pearson’s r and Spearman’s rank correlation ρ for paired data, with p-values, r² and a confidence interval for r.

Runs in your browser. What you enter stays on this page and is not uploaded.

Separate values with spaces, commas, tabs or new lines (paste a spreadsheet column). Use a point for decimals.

Results

Pearson r0.5712p (Pearson)0.1082Spearman ρ0.6p (Spearman)0.0968

With fewer than 10 pairs, correlation estimates are very imprecise; look at the interval, not only the p-value.

Pairs n
9
Hypothesis
two-sided
Coefficient of determination r²
0.326248
Correlation tests
MethodCoefficientTest statisticp-value95% CI
Pearson0.571182t = 1.84108, df = 70.1082-0.14974 to 0.89558
Spearman0.6S = 480.0968—

Pearson interval: Fisher’s z transformation. Spearman p-value: exact permutation distribution (n ≤ 9, no ties), as R.

Method and limits

How to use it

Paste the X values and the Y values in the same order — each position is one pair. The tool reports Pearson’s r (linear association) and Spearman’s ρ (monotonic association on ranks) with their tests.

Formulas

  • Pearson r = Σ(x − x̄)(y − ȳ) / √(Σ(x − x̄)² Σ(y − ȳ)²).
  • Test of ρ = 0: t = r √((n − 2) / (1 − r²)) with n − 2 df.
  • Confidence interval by Fisher’s z: tanh(atanh(r) ± zα/2 / √(n − 3)).
  • Spearman ρ is Pearson’s r on the ranks (tied values get average ranks); S = (n³ − n)(1 − ρ) / 6. Its p-value is exact (all n! orderings) for n ≤ 9 without ties, as R; otherwise the t approximation, as SciPy and SPSS.

Assumptions and limits

  • Pairs are independent. Pearson’s test assumes approximately bivariate normal data and a linear relation; one outlier can dominate r. Spearman needs only a monotonic relation.
  • Correlation is not causation, and r near 0 does not rule out a strong non-linear relation — plot the data.
  • Correlation does not depend on units or on which variable is called X.

Worked example

R’s cor.test example (Hollander and Wolfe): r = 0.571, t = 1.841 with 7 df, p = 0.108, 95% CI −0.150 to 0.896. Spearman: ρ = 0.6, S = 48, exact p = 0.0968.

References

Related tools

Share this page

Remind me to visit Contifield

Adds a repeating reminder to your calendar, titled “Contifield Reminder: Visit www.contifield.com”.