Product moment and Spearman's rank correlation

Product moment and Spearman's rank correlation

Spec 3.1–2 · Edexcel A-Level Further Maths: Revision notes

Studying this course? Keep your progress in one place.

Key facts

  • The product moment correlation coefficient r=SxySxxSyyr=\frac{S_{xy}}{\sqrt{S_{xx}S_{yy}}} measures linear correlation, −1≤r≤1-1\le r\le1.
  • It needs a roughly elliptical scatter (bivariate normal) with no clear curve or outlier.
  • Coding does not change the size of rr; it changes sign only if exactly one multiplier is negative.
  • Spearman's rank correlation coefficient rs=1−6∑d2n(n2−1)r_s=1-\frac{6\sum d^2}{n(n^2-1)} measures monotonic association from ranks.
  • Tied values share the mean rank; use Spearman for ranks, curved monotonic data or outliers.

The product moment correlation coefficient

Find SxxS_{xx}, SyyS_{yy} and SxyS_{xy} from summary statistics, then r=SxySxxSyyr=\frac{S_{xy}}{\sqrt{S_{xx}S_{yy}}}.

The product moment correlation coefficient rr measures the strength of linear correlation, with −1≤r≤1-1\le r\le1.

Sxx=∑x2−(∑x)2n,Syy=∑y2−(∑y)2n,Sxy=∑xy−∑x∑ynS_{xx}=\sum x^2-\frac{(\sum x)^2}{n},\quad S_{yy}=\sum y^2-\frac{(\sum y)^2}{n},\quad S_{xy}=\sum xy-\frac{\sum x\sum y}{n}

Values near ±1\pm1 show strong correlation and values near 00 show little.

  • PMCCr=SxySxxSyyr=\dfrac{S_{xy}}{\sqrt{S_{xx}S_{yy}}}

Worked example

Sxx=62.5S_{xx}=62.5, Syy=40S_{yy}=40 and Sxy=−45S_{xy}=-45. Find rr and describe the correlation.

Which value of rr shows the strongest linear correlation?

Conditions and coding

The PMCC suits an elliptical scatter; coding leaves the size of rr unchanged.

The PMCC needs data from a bivariate normal distribution: the scatter should look roughly elliptical, with no clear curve and no outlier.

Coding is a linear change such as x′=ax+bx'=ax+b, y′=cy+dy'=cy+d. It never changes the size of rr. If aa and cc have the same sign, rr is unchanged; if exactly one is negative, rr changes sign.

Example: r=−0.9r=-0.9 between xx and yy becomes +0.9+0.9 between xx and w=100−2yw=100-2y.

Multipliers of the same sign

  • r unchanged
  • e.g. 3x + 1 and 2y − 5

Multipliers of opposite signs

  • r changes sign, same size
  • e.g. 3x + 1 and 5 − 4y

r=0.8r=0.8 between xx and yy. What is rr between 3x+13x+1 and 5−4y5-4y?

Spearman's coefficient

It measures how well a monotonic function describes the link between two variables, using ranks.

Spearman's rank correlation coefficient rsr_s measures how well the relationship can be described by a monotonic function (always increasing or always decreasing).

Use it for rank data, for data that are not bivariate normal, for a monotonic but non-linear relationship, or when outliers are present. Rank each variable, find the rank difference dd for each pair, then use the formula.

  • Spearmanrs=1−6∑d2n(n2−1)r_s=1-\dfrac{6\sum d^2}{n(n^2-1)}

Worked example

n=6n=6 and ∑d2=6\sum d^2=6. Find rsr_s.

Which situation calls for Spearman's coefficient rather than the PMCC?

Ties in ranks

Tied values each get the mean of the ranks they would have occupied.

When values are equal, give each the mean rank of the places they occupy. Two scores sharing 3rd and 4th place both get rank 3.53.5, and the next value is rank 55.

The formula for rsr_s assumes no tied ranks, so with ties it is an approximation (the exact value is the PMCC of the ranks). You may enter the ranks into a calculator instead.

  1. 1

    Order the values

    smallest first

  2. 2

    Share the ranks

    mean of the places occupied

  3. 3

    Carry on

    the next value skips the used places

Ranking with ties

Worked example

Mathematics scores 56,61,61,70,48,75,6656, 61, 61, 70, 48, 75, 66 have physics ranks 3,4,2,6,1,7,53, 4, 2, 6, 1, 7, 5. Find rsr_s.

Three values tie for 2nd, 3rd and 4th place. What rank does each get?

Choosing and interpreting

Use the PMCC for a linear scatter of measured values, and Spearman's for ranks, curves or outliers.

Use the PMCC when the data are measured and the scatter is roughly elliptical (linear association).

Use Spearman's when the data are ranks, when the relationship is monotonic but not linear, or when an outlier is present. If rsr_s is much larger than rr, the relationship may be curved or contain an extreme value.

Interpret in context: rs=0.94r_s=0.94 means students who score highly in mathematics tend to score highly in physics. Do not claim cause.

  1. 1

    Look at the data

    measured values or ranks?

  2. 2

    Ranks only

    use Spearman's coefficient

  3. 3

    Measured values

    draw the scatter diagram

  4. 4

    Roughly elliptical, no outlier

    use the PMCC

  5. 5

    Curved but monotonic, or outliers

    use Spearman's coefficient

Which coefficient?

A scatter diagram shows a clear upward curve with no outliers. Which coefficient suits it?

Try an exam question

Two judges rank five entries in a competition. Judge A ranks them 1,2,3,4,51,2,3,4,5 and judge B ranks the same entries 2,1,4,3,52,1,4,3,5. Calculate Spearman's rank correlation coefficient.

[4 marks]

That's the notes covered.

Carry on to the next subtopic.

Try a question

Calculate the product moment correlation coefficient between xx and yy.

1 mark, marked against the mark scheme

Revision notes