Correlation coefficient calculator
Pearson r measures how close five points lie to a straight line, from -1 through 0 to +1. The regression slope comes out of the same sums.
Pearson correlation r
0.987 878
- R squared Share of the variance in y explained by x.
- 0.975 904
- Regression slope
- 1.800 000
- Regression intercept
- 0.200 000
Show the working
- x1 = 1
- y1 = 2
- x2 = 2
- y2 = 4
- x3 = 3
- y3 = 5
- x4 = 4
- y4 = 8
- x5 = 5
- y5 = 9
- n = 5 = 5
- sx = 1+2+3+4+5 = 15
- sy = 2+4+5+8+9 = 28
- sxy = 1*2 + 2*4 + 3*5 + 4*8 + 5*9 = 102
- sxx = 1^2 + 2^2 + 3^2 + 4^2 + 5^2 = 55
- syy = 2^2 + 4^2 + 5^2 + 8^2 + 9^2 = 190
- num = 5*102 - 15*28 = 90
- den = sqrt((5*55 - 15^2) * (5*190 - 28^2)) = 91.1043
- Pearson correlation r = 91.1043 != 0 ? 90/91.1043 : 0 = 0.987 878
- R squared = 0.987 878^2 = 0.975 904
- Regression slope = (5*55 - 15^2) != 0 ? 90/(5*55 - 15^2) : 0 = 1.8
- Regression intercept = (28 - 1.8*15)/5 = 0.2
Values are shown to six significant figures here; the arithmetic itself runs on exact fractions and is only rounded where a number is printed.
Scenarios & local history
Compare a saved scenario
Recent calculations
The formula
- r = (n sum(xy) - sum(x) sum(y)) / sqrt((n sum(x^2) - sum(x)^2)(n sum(y^2) - sum(y)^2))
- slope = (n sum(xy) - sum(x)sum(y)) / (n sum(x^2) - sum(x)^2)
Correlation measures linear association only. A perfect parabola has an r near zero.