Correlation and Regression
Product Moment Correlation Coefficient

This is also known as Pearson's correlation coefficient and, like Spearman's, it satisfies

−1 ≤ r ≤ 1

but it is not based on ranking the data but uses the actual data values. We will first introduce the idea of 'covariance'.

Worked Examples

1
The data below gives the marks obtained by 10 pupils taking Maths and Physics tests.
PupilABCDEFGHIJ
Maths mark
(out of 30)
x
2023829141111201717
Physics mark
(out of 40)
y
30352133332622313336

Is there a connection between the marks gained by ten pupils, A, B, C ..., J in Maths and Physics tests?

Show me

As a starting point, plot the marks as a scatter diagram.

The areas in the bottom right and top left of the graph are largely vacant so there is a tendency for the points to run from bottom left to top right.

Now calculate the means,

\overline{x} = \frac{170}{10} = 17

and

\overline{y} = \frac{300}{10} = 30

Using the means to divide the graph into four shows this tendency clearly.

The problem though is to find a way to measure how strong the tendency is.
We can attempt to quantify the tendency to go from bottom left to top right by evaluating the expression

s_{xy}=\frac{1}{n}\sum_{i=1}^n\left(x_i-\overline{x}\right)\left(y_i-\overline{y}\right)

which is known as the covariance and denoted by cov(X,Y) or s_{xy}. For shorthand it is normally written as

\frac{1}{n}\sum_{\ }^{\ }\left(x-\overline{x}\right)\left(y-\overline{y}\right)

where the summation over i is assumed.

The points in the top right have x and y values greater than \overline{x} and \overline{y} respectively, so x - \overline{x} and y - \overline{y} are both positive and so is the product \left(x-\overline{x}\right)\left(y-\overline{y}\right).

Those in the bottom left have values less than \overline{x} and \overline{y} , so x - \overline{x} and y - \overline{y} are both negative and again the product \left(x-\overline{x}\right)\left(y-\overline{y}\right) is positive.

Points in the other two areas have one of x - \overline{x} and y - \overline{y} positive and the other negative, so x - \overline{x} and y - \overline{y} is negative.

The \frac{1}{n} factor accounts for the fact that the number of points will affect the value of the covariance.

In the example above, most of the points give positive values of \left(x-\overline{x}\right)\left(y-\overline{y}\right).

There is another form of the expression for covariance which is easier to use in calculations.

\frac{1}{n}\sum_{\ }^{\ }\left(x-\overline{x}\right)\left(y-\overline{y}\right) = \frac{1}{n}\sum_{\ }^{\ }\left(xy-\overline{x}y-x\overline{y}+\overline{xy}\right)
= \frac{1}{n}\left(\sum_{\ }^{\ }xy-\sum_{\ }^{\ }\overline{x}y-\sum_{\ }^{\ }x\overline{y}+\sum_{\ }^{\ }\overline{xy}\right)
= \frac{1}{n}\left(\sum_{\ }^{\ }xy-\overline{x}\sum_{\ }^{\ }y-\overline{y}\sum_{\ }^{\ }x+n\overline{xy}\right)
= \frac{1}{n}\left(\sum_{\ }^{\ }xy-\overline{x}n\overline{y}-\overline{y}n\overline{x}+n\overline{xy}\right) since \overline{y}=\frac{\sum_{\ }^{\ }y}{n},\ \overline{x}=\frac{\sum_{\ }^{\ }x}{n}
= \frac{1}{n}\left(\sum_{\ }^{\ }xy-n\overline{xy}\right)

Thus

\frac{1}{n}\sum_{\ }^{\ }\left(x-\overline{x}\right)\left(y-\overline{y}\right) = \frac{1}{n}\sum_{\ }^{\ }xy-\overline{xy}

The right hand side is quicker to evaluate. For the example on page 15, this form of the expression is usually used when calculating covariance.

s_{xy} = \frac{1}{10}\Sigma\ xy-17\times30
= \frac{1}{10}\times5313-510
= 21.3

( Σ xy is a function available on calculators with LR mode.)

The fact that s_{xy} > 0 indicates that the points follow a trend with a positive slope. The size of the number, however, conveys little as it can easily be altered by a change of scale. The following examples show this.

2

Find the covariance for the following data.

(a)
Height (m) x1.601.641.71
Weight (kg) y535760
Show me
s_{xy} = \frac{1}{3}\times280.88-\frac{170}{3}\times\frac{4.95}{3}
= 0.126
(b)
Height (cm) x160164171
Weight (kg) y535760
Show me
s_{xy} = \frac{1}{3}\times28088-\frac{170}{3}\times\frac{495}{3}
= 12.\dot{6}

You can, of course, get quite different values by measuring in pounds and inches or kg and feet, etc. They will all be positive but their sizes will not convey useful information.

\frac{x-\overline{x}}{s_x}

will give the same answer regardless of the units or scale involved. The quantity

\frac{1}{n}\sum_{\ }^{\ }\left(\frac{x-\overline{x}}{s_x}\right)\left(\frac{y-\overline{y}}{s_y}\right)

can therefore be relied on to produce a value with more meaning than the covariance.

Since

\frac{1}{n}\sum_{\ }^{\ }\left(\frac{x-\overline{x}}{s_x}\right)\left(\frac{y-\overline{y}}{s_y}\right)=\frac{\frac{1}{n}\text{Σ}xy-\overline{xy}}{s_xs_y}

and the latter is easier to evaluate, Pearson's product moment correlation coefficient is often given as

r=\frac{\frac{1}{n}\text{Σ}xy-\overline{xy}}{s_xs_y}

where

s_x=\sqrt{\frac{1}{n}\text{Σ}x^2-\overline{x}^2} and s_x=\sqrt{\frac{1}{n}\text{Σ}y^2-\overline{y}^2}

(Note that r is a function given on calculators with LR mode.)

Returning to the Worked Example above:

PupilABCDEFGHIJ
Maths mark
(out of 30)
x
2023829141111201717
Physics mark
(out of 40)
y
30352133332622313336

r = \frac{\frac{1}{10} × 5313 - 17 × 30}{s_x × s_y}

s_x = \sqrt{\frac{1}{10} × 3250 - 17^2} = \sqrt{36} = 6

s_y = \sqrt{\frac{1}{10} × 9250 - 30^2} = \sqrt{25} = 5

⇒r = \frac{531.3 - 510}{6 × 5}
= 0.71
3

A group of twelve children participated in a psychological study designed to assess the relationship, if any, between age, x years, and average total sleep time (ATST), y minutes. To obtain a measure for ATST, recordings were taken on each child on five consecutive nights and then averaged. The results obtained are shown in the table.

Calculate the value of the product moment correlation coefficient between x and y.

Assess the statistical significance of your value and interpret your results.

Show me

Use the formula

s_{xy} = \frac{1}{n}\text{Σ}xy-\overline{xy}

when \overline{x} = \frac{108}{12} = 9 and \overline{y} = \frac{6372}{12} = 531

Thus s_{xy} = \frac{1}{12}(56825.4) - 9 × 531 = -43.55

Also

s_x = \sqrt{\frac{1}{12} × 1060.1 - 9^2} ≈ 2.7096

s_y = \sqrt{\frac{1}{12} × 3396942 - 531^2} ≈ 33.4290

Hence

r = \frac{-43.55}{2.7096 × 33.4290} ≈ -0.481

Exercises

For each of the following sets of data, draw a scatter diagram in your exercise book and calculate the product moment correlation coefficient.
(a)
x1361012
y5133254149
r =
(b)
x13579
y443424144
r =
(c)
x11355
y51315
r =
(d)
x136911
y1228372812
r =
The diameter of the longest lichens growing on gravestones were measured.
Age of gravestone
x (years)
Diameter of lichen
y (mm)
92
183
204
3120
4422
5241
5335
6122
6328
6332
6435
6441
11451
14152

Draw a scatter diagram in your exercise book to show the data.

(a)

Calculate the values of \overline{x} and \overline{y} and show these on the diagram.

\overline{x} =

\overline{y} = (to 1 d.p.)

(b)

Find the values of s_x, s_y and r.

s_x =

s_y =

r = (to 3 d.p.)