Correlation coefficient calculator
Paste paired x and y values, get Pearson's r.
What is the correlation coefficient?
Pearson's r measures how closely two variables follow a straight line, from −1 (perfect downward) through 0 (none) to +1 (perfect upward). For x = 1–5 and y = 2, 4, 5, 4, 5, r = 0.775. The square of r, R², is the share of the variation in y that the straight line accounts for: here 60%.
How is r calculated?
r = Σ(x − x̄)(y − ȳ) ÷ √(Σ(x − x̄)² × Σ(y − ȳ)²). In the example the means are x̄ = 3 and ȳ = 4, so Σ(x − x̄)(y − ȳ) = 6, Σ(x − x̄)² = 10 and Σ(y − ȳ)² = 6, and r = 6 ÷ √(10 × 6) = 0.775. The same quantities give the regression slope, 6 ÷ 10 = 0.6, so r and the slope always have the same sign.
Is the correlation significant?
The test uses t = r√(n − 2) ÷ √(1 − r²) with n − 2 degrees of freedom; the null hypothesis is that the population correlation is 0 (OpenStax, section 12.4). With only 5 points, r = 0.775 gives t = 2.12, 3 degrees of freedom and p ≈ 0.12 — not significant at the usual 0.05 level. OpenStax’s own example has 11 students, r = 0.6631, so t = 2.66 with 9 degrees of freedom and p = 0.026; the 5% critical value of r for 9 degrees of freedom is ±0.602, and 0.6631 is beyond it.
How much can one point change r?
A lot, especially in a small data set. Add a sixth point (6, 0) to the example, a value far below the pattern, and r drops from 0.775 to −0.217. Changing the units does not move it: multiplying every y by 1,000 leaves r at 0.775, and replacing y by −y flips only the sign, to −0.775. So r describes how well a straight line fits, not how steep the line is or what the units are, and one unusual point deserves a look at the scatter plot before the number is trusted.
What counts as a strong correlation?
Rules of thumb vary by field; many treat |r| above about 0.7 as strong and below 0.3 as weak. Always look at a scatter plot too. Significance and strength are different questions: with 100 points, even r = 0.2 gives p = 0.046 and counts as significant, though it explains only 4% of the variation.
Does zero correlation mean no relationship?
Only no straight-line relationship. A curved pattern, like a U shape, can have r near 0.
Why do I need to look at a scatter plot? Anscombe’s quartet
In 1973 Francis Anscombe published four small data sets of 11 points each. All four have a correlation of 0.82 to two decimals, and every one has the regression line y = 3.00 + 0.50x. One is a clean straight-line scatter, one is a smooth curve, one is a near-perfect straight line spoiled by a single outlier, and in the last all points but one share the same x, so that a single point decides the slope. The numbers cannot tell them apart; a plot can.
Common mistakes with correlation
First, reading correlation as causation: two variables can move together because of a third factor, or by coincidence. Second, ignoring outliers, which can create or hide a correlation, as in Anscombe’s third and fourth sets. Third, using r on a curved relationship; Spearman’s rank correlation handles monotonic but non-linear trends better. Fourth, pairing the wrong values: the x and y lists must be in matching order and the same length.
Sources: OpenStax, Introductory Statistics 2e, section 12.4 (Testing the Significance of the Correlation Coefficient); Anscombe, F. J. (1973), “Graphs in statistical analysis”, The American Statistician 27(1), 17–21. Related: linear regression calculator, Spearman correlation calculator, covariance calculator, p-value calculator and standard deviation calculator.