Skip to content

Economics · Ch 13 — Correlation

Karl Pearson's Coefficient Of Correlation

13.3.2

Karl Pearson's Coefficient Of Correlation

Karl Pearson's coefficient of correlation — also called the product moment or simple correlation coefficient — gives a precise numerical value for the degree of linear relationship between two variables X and Y. It should be used only when the relationship is linear; applied to a non-linear relation (as in figures 6.6 and 6.7) it can mislead. So one should examine the scatter diagram first.

Building blocks. For NN paired values, the arithmetic means are

Xˉ=∑XN,Yˉ=∑YN\bar{X} = \frac{\sum X}{N}, \qquad \bar{Y} = \frac{\sum Y}{N}

Writing the deviations from the mean as x=X−Xˉx = X - \bar{X} and y=Y−Yˉy = Y - \bar{Y}, the variances are

σX2=∑(X−Xˉ)2N=∑x2N,σY2=∑(Y−Yˉ)2N=∑y2N\sigma_X^2 = \frac{\sum (X-\bar{X})^2}{N} = \frac{\sum x^2}{N}, \qquad \sigma_Y^2 = \frac{\sum (Y-\bar{Y})^2}{N} = \frac{\sum y^2}{N}

The standard deviations σX\sigma_X and σY\sigma_Y are the positive square roots of these variances. The covariance is

Cov(X,Y)=∑(X−Xˉ)(Y−Yˉ)N=∑xyNCov(X,Y) = \frac{\sum (X-\bar{X})(Y-\bar{Y})}{N} = \frac{\sum xy}{N}

The sign of the covariance fixes the sign of the correlation coefficient (the standard deviations are always positive); if the covariance is zero, so is the correlation.

Four equivalent formulas for r.

r=∑xy/NσX σY(1)r = \frac{\sum xy / N}{\sigma_X \, \sigma_Y} \quad (1)

r=∑(X−Xˉ)(Y−Yˉ)∑(X−Xˉ)2  ∑(Y−Yˉ)2(2)r = \frac{\sum (X-\bar{X})(Y-\bar{Y})}{\sqrt{\sum (X-\bar{X})^2 \; \sum (Y-\bar{Y})^2}} \quad (2)

r=∑XY−(∑X)(∑Y)N∑X2−(∑X)2N  ∑Y2−(∑Y)2N(3)r = \frac{\sum XY - \dfrac{(\sum X)(\sum Y)}{N}}{\sqrt{\sum X^2 - \dfrac{(\sum X)^2}{N}} \; \sqrt{\sum Y^2 - \dfrac{(\sum Y)^2}{N}}} \quad (3)

r=N∑XY−(∑X)(∑Y)N∑X2−(∑X)2  N∑Y2−(∑Y)2(4)r = \frac{N\sum XY - (\sum X)(\sum Y)}{\sqrt{N\sum X^2 - (\sum X)^2} \; \sqrt{N\sum Y^2 - (\sum Y)^2}} \quad (4)

Worked example (Example 1): years of schooling of farmers (X) vs annual yield per acre in '000 Rs (Y).

XYX−XˉX-\bar{X}(X−Xˉ)2(X-\bar{X})^2Y−YˉY-\bar{Y}(Y−Yˉ)2(Y-\bar{Y})^2(X−Xˉ)(Y−Yˉ)(X-\bar{X})(Y-\bar{Y})
04-636-3918
24-416-3912
46-24-112
61000390
81024396
108416114
127636000
Σ = 42Σ = 491123842

Here N=7N = 7, so Xˉ=42/7=6\bar{X} = 42/7 = 6 and Yˉ=49/7=7\bar{Y} = 49/7 = 7. Using formula (2): …