Correlation Coefficient
Pearson r or Spearman rho with r squared, the t statistic, its degrees of freedom and a two-tailed p.
What this page computes
Type the two variables as comma-separated lists of equal length and choose Pearson or Spearman. Pearson r = Σ(x − x̄)(y − ŷ) / √(Σ(x − x̄)² · Σ(y − ŷ)²); Spearman rho is the same formula on ranks, with ties given their average rank. The test is t = r√((n − 2)/(1 − r²)) on n − 2 degrees of freedom, and the printed p is two-tailed for the hypothesis that the correlation is zero. Every figure prints to six significant figures.
Correlation is not causation and the page says nothing about either. A constant variable is refused, because its standard deviation is zero; a perfect correlation is refused, because the t statistic would divide by zero.
The two lists stay in the browser, and the same pairs always print the same r and p.
The page computes Pearson’s r = Sxy/√(Sxx·Syy), or Spearman’s ρ from the same formula applied to ranks, and tests it with t = r√((n − 2)/(1 − r²)). Five pairs give r = 0.774597 and r² = 0.6, with t = 2.12132 on 3 degrees of freedom and p = 0.124027. The p-value is two-tailed and the degrees of freedom are printed, because a bare correlation leaves both the strength and the sample size invisible.
Compute Pearson or Spearman correlation from two comma-separated lists, with the two-tailed test for r = 0.
How to use it
Type the x values as a comma-separated list and the y values the same way; the lists must be the same length. Choose Pearson for the raw values or Spearman for ranks, where tied values share their average rank. At least three pairs are needed, since n − 2 degrees of freedom would otherwise be zero or negative.
Pearson, Spearman and the two-tailed test
r² is printed beside r because a correlation of 0.77 explains 60% of the variation, not 77%, and the two numbers are easy to confuse. Spearman is not a different test on the same data: it ranks each list first, so a single extreme pair moves it far less than it moves Pearson. The t statistic tests r = 0 against r ≠ 0 with n − 2 degrees of freedom and a two-tailed p; the page does not test whether r equals any other value.
What to Expect
Best for
- Checking the strength of a linear or monotone association
What this tool keeps
- Nothing leaves this tab: the arithmetic runs in the page you are reading, and a reload discards both the input and the result.
Sample output
Pearson r = 0.774597 r² = 0.6 n = 5 pairs t = 2.12132, df = 3, p = 0.124027 (two-tailed, H₁: ρ ≠ 0)
Frequently asked questions
Is the p-value one-tailed or two-tailed?
Two-tailed, testing r = 0 against r ≠ 0, with n − 2 degrees of freedom. Both the t statistic and the degrees of freedom are printed on the result line.
When should I use Spearman instead of Pearson?
When the relationship is monotone but not linear, or when one extreme pair would dominate the raw values. Spearman ranks both lists first and gives tied values their average rank.
Is my data uploaded?
No. Both lists stay in this page; r, r² and the p-value are computed here and nothing is posted or stored.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.