The formula
r = Σ(x − x̄)(y − ȳ) / √( Σ(x − x̄)² · Σ(y − ȳ)² )
What it means
Pearson normalises the covariance by dividing it by the product of the two deviations, and that leaves the result free of units and always between −1 and 1. A 1 is a perfect rising line, a −1 a perfect falling one, and a 0 means there is no linear relationship. Its square, R², is the share of one variable's variation that the other one explains.
How to work it out by hand
- Work out the mean of each variable
- For each pair, multiply the deviation of x by the deviation of y, and add them up
- Divide by the root of the product of each variable's sum of squares
- The answer lies between −1 and 1: that is the coefficient
What is worth knowing
Pearson only sees linear relationships. A perfect parabola can give a correlation of zero, and that does not mean there is no relationship: it means it is not a straight line. So look at the scatter before you look at the number. And the usual warning: correlation is not cause. Two variables may correlate because one causes the other, because both depend on a third, or by sheer coincidence, and the coefficient cannot tell those three apart.