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.