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.
Results
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
| Method | Coefficient | Test statistic | p-value | 95% CI |
|---|---|---|---|---|
| Pearson | 0.571182 | t = 1.84108, df = 7 | 0.1082 | -0.14974 to 0.89558 |
| Spearman | 0.6 | S = 48 | 0.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
- Linear regression calculatorLeast-squares line with standard errors, t-tests, R², ANOVA table, residuals and leverage, plus confidence and prediction intervals at any x.
- Cronbach’s alpha calculatorInternal-consistency reliability of a scale: Cronbach’s α with Feldt’s confidence interval, standardized α and α-if-item-deleted for each item.
- Cohen’s kappa calculatorAgreement between two raters beyond chance: Cohen’s κ, linear or quadratic weighted κ, standard error, confidence interval and z-test.
- Standard deviation calculatorPaste data to get the standard deviation (sample and population), variance, mean, median, mode, quartiles with the method stated, IQR, outliers, skewness and kurtosis.
- T-test calculatorOne-sample, independent two-sample (Welch and pooled) and paired t-tests from raw data or summary statistics, with confidence intervals and Cohen’s d.
- P-value calculatorFind the p-value and critical values for a z, t, chi-square or F test statistic, one- or two-tailed, accurate far into the tails.