MathsFurther Statistics 2 › Correlation coefficients: product moment and Spearman

Correlation coefficients: product moment and Spearman

Two numbers between −1 and 1, measuring two different things. One asks how close the points are to a straight line. The other only asks whether the orders agree.

Builds on Least squares regression and residuals and Correlation and regression.

IN THIS TOPIC

  • Calculate the product moment correlation coefficient from summary statistics.
  • State the conditions under which it is the appropriate measure.
  • Predict the effect of coding on it without recalculating.
  • Rank data, handle ties, and calculate Spearman's coefficient.

COMMON MISCONCEPTION

A correlation coefficient near zero means the two variables are unrelated.

Measuring straightness

The product moment correlation coefficient scales the covariance so that it always lies between −1 and 1:

r=SxySxxSyyr = \frac{S_{xy}}{\sqrt{S_{xx} S_{yy}}}IN THE FORMULAE BOOKLET

The booklet prints it under Correlation and regression, with three equivalent expanded forms beneath it, and the critical values for r are tabulated later in the same booklet. It measures linear association and nothing else. Points sitting perfectly on a parabola can give r near zero while being completely determined by each other. A small r rules out a straight-line relationship. It does not rule out a relationship. Sketch the scatter before you trust the number.

Three conditions matter before you quote r. The two variables must both be quantitative. The relationship being tested must be a linear one. And r is badly distorted by a single extreme point, so look for outliers first. One stray reading can move a coefficient a long way on its own.

The product moment correlation coefficient on a scale from −1 to 1, with the five-point data set at 0.853−1010.853perfect negativeperfect positiver = S(xy) / √(S(xx) S(yy)) = 8 / √88
FIG. 1The correlation scale from −1 to 1 with the worked data set marked at 0.853, well into strong positive territory.

WORKED EXAMPLE

The coefficient from summary statistics

For the five points (1, 2), (2, 4), (3, 5), (4, 4), (5, 6), find r.

From before, Sxx = 10 and Sxy = 8, and Syy = 97 − 21²/5 = 8.8.

r = 8/√(10 × 8.8) = 8/√88 = 0.853 to three decimal places.

Strong positive linear correlation, which matches the scatter and the small residual sum of squares found earlier.

What coding does to r

Coding by a linear rule cannot alter how straight the scatter is, so it cannot alter the size of r. Replace x by (x − a)/b and y by (y − c)/d, and the coefficient of the coded data has exactly the same magnitude as the original.

The sign is the one thing that can move. When b and d are both positive, r is unchanged outright. When exactly one of them is negative, one axis has been reflected and r flips sign. Two negatives cancel and leave r alone again. That saves real time in an exam, since you compute r from the coded totals and then simply state the value for the original data.

WORKED EXAMPLE

Coding in practice

Heights x in cm and masses y in kg are coded as p = (x − 150)/5 and q = y − 60. The coded data give r = 0.74. State r for the original data.

Both scale factors are positive, being 1/5 and 1, so the sign and the size both survive.

r = 0.74 for the original heights and masses. Recomputing from raw values would waste the time and risk an arithmetic slip.

When only the order matters

Spearman's rank correlation coefficient replaces each value by its rank and measures how well the two orderings agree. It is the right tool when the data are already ranks, when the relationship is rising or falling without being straight, or when an outlier would drag the product moment coefficient about. Its price is that it throws away the sizes of the gaps.

rs=1-6Σd2n(n2-1)r_{s} = 1 - \frac{6 Σ d^{2}}{n(n^{2} - 1)}IN THE FORMULAE BOOKLET

The booklet prints it directly under the product moment coefficient, and tabulates Spearman's critical values alongside r's. Here d is the difference in ranks for each item. Tied values share the average of the ranks they would have taken, so two items tied for third and fourth both get 3.5. Once ties are present the formula becomes an approximation, and the product moment coefficient applied to the ranks is the exact version. Say which you used.

Two judges' rankings of eight competitors, with each pair differing by one place: Σd² = 8 and rs = 0.905judge A rankjudge B rankrs = 1 − 6Σd² / n(n² − 1) = 0.905
FIG. 2Eight competitors ranked by two judges, every pair differing by a single place: the sum of squared differences is 8.

GUIDED PRACTICE

Two judges disagree slightly

Judge A ranks eight competitors 1 to 8 in order. Judge B ranks them 2, 1, 4, 3, 6, 5, 8, 7. Calculate Spearman's coefficient and interpret it.

Show the working

The differences are −1, 1, −1, 1, −1, 1, −1, 1, so d² = 1 each time and Σd² = 8.

n(n² − 1) = 8 × 63 = 504, so rs = 1 − 48/504 = 1 − 0.0952.

That is 0.905 to three decimal places. The judges agree very closely, differing only by swapping adjacent pairs.

ASSESSMENT FOCUS

  • Quote the formula before substituting. The summary statistics carry method marks on their own.
  • Say what r measures in context, and add that it detects linear association only.
  • For Spearman, set the ranks out in a table with a d column and a d² column.
  • Coding leaves the size of r alone, so state the coded value as the answer instead of recalculating.

CHECK YOURSELF

Six items are ranked by two people. The rank differences are 1, −1, 0, 2, −1, −1. Find Spearman's coefficient.

Show a hint

Square, sum, then substitute with n = 6.

Show the answer

Σd² = 1 + 1 + 0 + 4 + 1 + 1 = 8. n(n² − 1) = 6 × 35 = 210, so rs = 1 − 48/210 = 1 − 0.2286 = 0.771 to three decimal places.

The product moment coefficient r = S(xy)/√(S(xx)S(yy)) measures linear association only, and linear coding leaves its size unchanged.

Spearman's rs = 1 − 6Σd²/[n(n² − 1)] measures agreement of orderings, with tied values sharing the average rank.

WORKBOOK

Printable practice for this topic: original exam-style questions with room to work, and a fully worked answer book. Free to use; please do not redistribute or sell.

6 questions on this topicAnswer them one at a time and mark yourself against the worked answer.Practise this topic

Or read them with their worked answers on the correlation coefficients: product moment and spearman questions page.

CHECK YOUR PROGRESS

Rate how confident you feel with each objective for this lesson. Ratings are saved in this browser, on this device, unless you sign in.

  • Calculate the product moment correlation coefficient from summary statistics.
  • State the conditions under which it is the appropriate measure.
  • Predict the effect of coding on it without recalculating.
  • Rank data, handle ties, and calculate Spearman's coefficient.

Open the full revision checklist to see every objective in the course in one place.