How to Calculate the Correlation Coefficient
The Pearson correlation coefficient (r) measures the strength and direction of the linear relationship between two variables. It ranges from โ1 to +1, where +1 is a perfect positive correlation, โ1 is a perfect negative correlation, and 0 means no linear relationship.
The Formula
r = ฮฃ[(xแตข โ xฬ)(yแตข โ ศณ)] / โ[ฮฃ(xแตข โ xฬ)ยฒ ร ฮฃ(yแตข โ ศณ)ยฒ]
Step-by-Step Example
Data: x = 5, y = 5
Step 1: Calculate means. xฬ = 3, ศณ = 4
Step 2: Calculate deviations.
| xแตข | yแตข | (xแตขโxฬ) | (yแตขโศณ) | Product | (xแตขโxฬ)ยฒ | (yแตขโศณ)ยฒ |
|---|---|---|---|---|---|---|
| 1 | 2 | โ2 | โ2 | 4 | 4 | 4 |
| 2 | 4 | โ1 | 0 | 0 | 1 | 0 |
| 3 | 5 | 0 | 1 | 0 | 0 | 1 |
| 4 | 4 | 1 | 0 | 0 | 1 | 0 |
| 5 | 5 | 2 | 1 | 2 | 4 | 1 |
Step 3: Sum the columns. ฮฃ products = 6, ฮฃ(xแตขโxฬ)ยฒ = 10, ฮฃ(yแตขโศณ)ยฒ = 6
Step 4: Apply the formula. r = 6 / โ(10 ร 6) = 6 / โ60 = 6 / 7.746 = 0.775
Interpreting r Values
| r Value | Interpretation |
|---|---|
| 0.9 to 1.0 | Very strong positive |
| 0.7 to 0.9 | Strong positive |
| 0.5 to 0.7 | Moderate positive |
| 0 to 0.5 | Weak positive |
| 0 | No linear relationship |
| Negative values | Same scale, opposite direction |
Important Caveat
Correlation does not imply causation. A high r value means two variables move together, but doesn't tell you why or which causes which.
Use our correlation coefficient calculator to analyze any dataset.