Proofs

All books

A correlation coefficient lies between −1 and 1

The product moment correlation coefficient is always between −1-1 and 11. That is not a convention about how the number is written. It is a consequence of an inequality that holds for any two lists of numbers.

Before you start

Write the two variables as x1,…,xnx_1,\dots,x_n and y1,…,yny_1,\dots,y_n, with means xˉ\bar x and yˉ\bar y. The deviations are ai=xi−xˉa_i=x_i-\bar x and bi=yi−yˉb_i=y_i-\bar y.

The correlation coefficient is

r=∑aibi∑ai2∑bi2.r = \frac{\sum a_i b_i}{\sqrt{\sum a_i^2}\sqrt{\sum b_i^2}}.

The numerator is the covariance and the denominator is the product of the two standard deviations, so rr is the covariance measured in units of both spreads.

The proof

Cauchy–Schwarz. For any real number tt,

∑(ai+tbi)2≥0,\sum (a_i + t b_i)^2 \ge 0,

because every term is a square. Expand the left side:

∑ai2+2t∑aibi+t2∑bi2≥0.\sum a_i^2 + 2t\sum a_i b_i + t^2\sum b_i^2 \ge 0.

This is a quadratic in tt that never goes below zero. Its discriminant is therefore at most zero:

(2∑aibi)2−4(∑ai2)(∑bi2)≤0.\left(2\sum a_i b_i\right)^2 - 4\left(\sum a_i^2\right) \left(\sum b_i^2\right) \le 0.

Divide by 44 and take square roots:

∣∑aibi∣≤∑ai2∑bi2.\left|\sum a_i b_i\right| \le \sqrt{\sum a_i^2}\sqrt{\sum b_i^2}.

Divide both sides by the positive denominator of rr:

∣r∣≤1.|r| \le 1.

That is the whole proof. It uses nothing about the data beyond the fact that the deviations are real numbers.

When the ends are reached

Equality holds exactly when the quadratic has a double root, which happens when bi=λaib_i = \lambda a_i for every ii. That is the case where every point lies on one straight line through (xˉ,yˉ)(\bar x,\bar y).

If λ>0\lambda>0 the line slopes up and r=1r=1. If λ<0\lambda\lt 0 it slopes down and r=−1r=-1. So the two extreme values are not a separate rule; they are the equality case of the inequality.

What this does not say

A value of rr near 00 says there is no linear pattern. It does not say the variables are unrelated. A perfect curve can have r=0r=0 and still be a perfect relationship.

The coefficient also does not tell you which variable causes the other, and it does not survive a change of which points are included. It is a summary of the linear part of one sample.

Settings

Colour scheme

Light or dark pages. Your colour and layout stay the same.

Colour

The paper, ink and lettering. Your layout stays the same.

Quiet colours
Bold colours
Layout

How pages are arranged. Your colours stay the same.

Reading offline

Keep this book on this device and read it offline.