Quick Answer
For x = [1, 2, 3, 4, 5] and y = [2, 4, 5, 4, 5], the Pearson correlation is r = 0.7746 (strong positive). For x = [1, 2, 3] and y = [2, 4, 6], r = 1.0 (perfect positive correlation).
Separate values with commas, spaces, or newlines
Each Y value pairs with the X value in the same position
Common Examples
| Input | Result |
|---|---|
| X = [1, 2, 3], Y = [2, 4, 6] | r = 1.0000 (perfect positive) |
| X = [1, 2, 3], Y = [6, 4, 2] | r = -1.0000 (perfect negative) |
| X = [1, 2, 3, 4, 5], Y = [2, 4, 5, 4, 5] | r = 0.7746 (strong positive) |
| X = [10, 20, 30, 40, 50], Y = [12, 19, 28, 42, 51] | r ≈ 0.9976 (very strong positive) |
How It Works
The formula
The Pearson correlation coefficient is defined as:
\[r = \frac{n\sum xy - \sum x \sum y}{\sqrt{\left(n\sum x^2 - \left(\sum x\right)^2\right)\left(n\sum y^2 - \left(\sum y\right)^2\right)}}\]Where n is the number of paired data points, x and y are the individual values, and the sums run over all pairs.
Range and interpretation
r always falls between -1 and +1:
- r = +1: perfect positive linear relationship (as X increases, Y increases proportionally)
- r = -1: perfect negative linear relationship (as X increases, Y decreases proportionally)
- r = 0: no linear relationship between X and Y
Strength scale
| r | range | Label | |
|---|---|---|---|
| 0.9 to 1.0 | Very strong | ||
| 0.7 to 0.9 | Strong | ||
| 0.5 to 0.7 | Moderate | ||
| 0.3 to 0.5 | Weak | ||
| 0.0 to 0.3 | Very weak or none |
R² (coefficient of determination)
R² is the square of r. It represents the proportion of variance in Y that is explained by X. For example, r = 0.8 gives R² = 0.64, meaning X accounts for 64% of the variation in Y. The remaining 36% comes from other factors.
Correlation vs. causation
A high r value shows that two variables move together, but it does not establish that one causes the other. A third variable may drive both, or the relationship may be coincidental. Correlation is a measure of association, not causation.
Worked example
For x = [1, 2, 3, 4, 5] and y = [2, 4, 5, 4, 5]:
n = 5, Σx = 15, Σy = 20, Σxy = 1×2 + 2×4 + 3×5 + 4×4 + 5×5 = 66, Σx² = 55, Σy² = 86
Numerator: 5 × 66 − 15 × 20 = 330 − 300 = 30
Denominator: √[(5 × 55 − 225)(5 × 86 − 400)] = √[(275 − 225)(430 − 400)] = √[50 × 30] = √1500 ≈ 38.73
r = 30 / 38.73 ≈ 0.7746, R² ≈ 0.5999
CalculateY