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แตขโˆ’ศณ)ยฒ
12โˆ’2โˆ’2444
24โˆ’10010
3501001
4410010
5521241

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 ValueInterpretation
0.9 to 1.0Very strong positive
0.7 to 0.9Strong positive
0.5 to 0.7Moderate positive
0 to 0.5Weak positive
0No linear relationship
Negative valuesSame 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.