Skip to content
DailyCalc

Correlation Coefficient Calculator

Pearson’s r for two data sets, with the least-squares line and how much variance it explains.

Last updated

Your details

Result

Correlation (r)
0.529809

Moderate positive relationship

R² — variance explained
28.0697%

The line accounts for 28.0697% of the variation in Y

Regression line
y = 0.3852x + 65.1416
Covariance
95.6
p-value for r ≠ 0
0.279645

Not significant at the 5% level

Pairs
6

SD of X 15.753, SD of Y 11.454

6 paired observations…

r = Σ((x−x̄)(y−ȳ)) ÷ √(Σ(x−x̄)² × Σ(y−ȳ)²)

Covariance = 95.6

SD(x) × SD(y) = 15.7533 × 11.4543 = 180.4424

95.6 ÷ 180.4424

r = 0.529809

Formula — written step by step

Six paired observations…

r = Σ((x−x̄)(y−ȳ)) ÷ √(Σ(x−x̄)² × Σ(y−ȳ)²)

Covariance = 95.6

SD(x) = 15.7533, SD(y) = 11.4543

95.6 ÷ (15.7533 × 11.4543)

r = 0.529809

r runs from −1 to +1. Zero means no linear relationship; the sign gives the direction and the magnitude the strength. Squaring it gives the share of variance the straight line accounts for.

A worked example

What r² actually tells you

Correlation
r = 0.53
Squared
r² = 0.28
  1. r² = 0.53² = 0.2809
  2. 28.09% of the variation in Y is explained
  3. The other 71.91% is not
  4. A "moderate" correlation explains under a third

Just 28% of the variance is accounted for

This is why r flatters relationships. A correlation of 0.5 sounds like half a relationship; it explains a quarter of the variation. Even r = 0.7, usually called strong, leaves more than half the variance unexplained.

How to use this calculator

  1. Paste your X values and your Y values, one list in each box, in matching order.
  2. Each X needs a Y — the calculator says so if the counts differ.
  3. Read r for direction and strength, and r² for how much of the variation the line accounts for.
  4. The p-value tests whether the correlation differs from zero. With a small sample even a large r can fail to reach significance.

What Pearson’s r measures

Pearson’s correlation coefficient measures the strength and direction of a straight-line relationship between two variables. It runs from −1, a perfect inverse relationship, through 0, no linear relationship at all, to +1, a perfect direct one.

It is scale-free. Converting heights from centimetres to inches, or prices from one currency to another, leaves r unchanged — which is what makes it comparable across studies measuring very different things.

Correlation is not causation, and r is not r²

That correlation does not imply causation is the most repeated warning in statistics, and still the most ignored. Two variables can move together because one causes the other, because both are driven by something else, or by pure coincidence in a small sample.

The less-repeated warning is that r overstates the relationship to the eye. The share of variance explained is r², not r. A correlation of 0.5 explains 25% of the variation, not half of it, and 0.3 explains under a tenth.

What r cannot see

Pearson’s r detects linear relationships only. A perfect parabola — y = x² over a symmetric range — has a correlation of exactly zero, despite y being completely determined by x. A low r rules out a straight line, not a relationship.

It is also acutely sensitive to outliers. A single extreme point can drag r from near zero to near one, or the reverse. Anscombe’s quartet is the classic demonstration: four data sets with identical correlations, means and regression lines, that look nothing alike when plotted. Always plot the data.

Formula & methodology

r = Σ((x−x̄)(y−ȳ)) ÷ √(Σ(x−x̄)² Σ(y−ȳ)²). Significance is tested with t = r√(n−2) ÷ √(1−r²) on n − 2 degrees of freedom.

What this calculator assumes

  • Detects linear relationships only. A perfect parabola has a correlation near zero, so a low r rules out a straight line rather than a relationship.
  • Highly sensitive to outliers — a single extreme point can move r from near zero to near one. Plot the data.
  • Computed from deviations about the mean rather than by the raw sum-of-squares shortcut, which loses catastrophic precision when values are large and their variance small.
  • Correlation does not establish causation, and r overstates the relationship to the eye: the variance explained is r², not r.

Sources

  1. NIST/SEMATECH e-Handbook of Statistical Methods, 2012 — measures of association.
  2. Anscombe, "Graphs in Statistical Analysis", The American Statistician 27(1), 1973 — four data sets with identical correlations that look nothing alike.

Interpreting r, and what it explains

|r|Usually calledr² — variance explained
0.9 to 1.0Very strong81% to 100%
0.7 to 0.9Strong49% to 81%
0.5 to 0.7Moderate25% to 49%
0.3 to 0.5Weak9% to 25%
0.0 to 0.3Very weak or noneUnder 9%

These labels are conventions, not thresholds, and they vary by field. In physics r = 0.9 may indicate a problem with the apparatus; in psychology it would be extraordinary.

Frequently asked questions

What is the difference between r and r²?

r measures strength and direction, from −1 to +1. r² is the share of variance in Y explained by the line, from 0 to 1. r = 0.7 sounds strong but explains only 49%.

Can a correlation of zero mean no relationship?

No — it means no linear relationship. A perfect U-shaped relationship has r near zero, which is why plotting the data matters more than the coefficient.

How many points do I need?

At least three, since two always fall exactly on a line. Correlations from fewer than about ten pairs are unstable, which is what the p-value here is testing.

Should I use Pearson or Spearman?

Pearson for linear relationships between roughly normal variables. Spearman, which correlates ranks instead, is better for ordinal data, monotonic-but-curved relationships, or data with outliers.