Skip to content

Working out the correlation coefficient

Working out the correlation coefficient

The product of the deviations

For each point, multiply the deviation of x\displaystyle x from its mean, x−xˉ\displaystyle x-\bar{x}, by the deviation of y\displaystyle y from its mean, y−yˉ\displaystyle y-\bar{y}:

  • a point right of the mean and above it, or left of it and below – the product is positive;
  • a point right and below, or left and above – the product is negative.

In a positive relation most points are of the first kind, and the sum of the products is positive; in a negative relation – the sum is negative; with no linear relation the products cancel each other out.

From raw data

Raw data is the data itself, as it was measured. The mean of the products is divided by the product of the two standard deviations, so that r\displaystyle r comes out between −1\displaystyle -1 and 1 and has no units:

r=1N⋅Sx⋅Sy[(x1−xˉ)(y1−yˉ)+⋯+(xN−xˉ)(yN−yˉ)]\displaystyle r=\frac{1}{N\cdot S_x\cdot S_y}\left[(x_1-\bar{x})(y_1-\bar{y})+\dots+(x_N-\bar{x})(y_N-\bar{y})\right]

N\displaystyle N is the number of points, and Sx\displaystyle S_x, Sy\displaystyle S_y are the standard deviations of x\displaystyle x and of y\displaystyle y.

Example: a working table

Five pupils wrote down how many exercises they did at home (x\displaystyle x) and how many exercises they got right in a quiz (y\displaystyle y).
xˉ=3\displaystyle {\bar{x}}={3}, yˉ=4\displaystyle {\bar{y}}={4}.

x\displaystyle xy\displaystyle yx−xˉ\displaystyle x-\bar{x}y−yˉ\displaystyle y-\bar{y}The product
12−2\displaystyle -2−2\displaystyle -24
24−1\displaystyle -100
35010
44100
55212
  • The sum of the products: 6.
  • Sx=4+1+0+1+45=2\displaystyle {S_x}={\sqrt{\frac{4+1+0+1+4}{5}}}={\sqrt{2}}, and Sy=4+0+1+0+15=1.2\displaystyle {S_y}={\sqrt{\frac{4+0+1+0+1}{5}}}={\sqrt{1.2}}.
  • r=65⋅2⋅1.2≈0.77\displaystyle {r}={\frac{6}{5\cdot\sqrt{2}\cdot\sqrt{1.2}}\approx0.77}: a strong positive linear relation.
From standardised data

Standardised data is the standard scores of the data: zx=x−xˉSx\displaystyle {z_x}={\frac{x-\bar{x}}{S_x}} and zy=y−yˉSy\displaystyle {z_y}={\frac{y-\bar{y}}{S_y}}. In them the division by the standard deviations is already done, and r\displaystyle r is the mean of the products of the standard scores:

r=1N[(zx)1(zy)1+⋯+(zx)N(zy)N]\displaystyle r=\frac{1}{N}\left[(z_x)_1(z_y)_1+\dots+(z_x)_N(z_y)_N\right]

This formula shows why r\displaystyle r does not change when a number is added to the data or the units are changed: the standard scores do not change. With a lot of data, r\displaystyle r is worked out on a calculator or in a spreadsheet.

Exercise 1
x\displaystyle x1234567
y\displaystyle y2143756
a

Work out Sx\displaystyle S_x.

    / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

    / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

    b

    Work out Sy\displaystyle S_y.

      / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

      / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

      c

      Work out the correlation coefficient, to two decimal places.

        / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

        / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

        Exercise 2

        The owner of a shop selling tablets looked at the relation between the screen size in inches (x\displaystyle x) and the number of minutes a customer needs to decide to buy the tablet (y\displaystyle y).
        On one day 8 different models were sold.

        Screen size x\displaystyle x999911111111
        Minutes y\displaystyle y210101010101018
        a

        Work out xˉ\displaystyle \bar{x} and Sx\displaystyle S_x. Write Sx\displaystyle S_x in the card.

          / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

          / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

          b

          Work out yˉ\displaystyle \bar{y} and Sy\displaystyle S_y. Write Sy\displaystyle S_y in the card.

            / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

            / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

            c

            Work out the correlation coefficient.

              / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

              / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power

              Exercise 3

              Here are the standard scores of five pupils in two tests.

              zx\displaystyle z_x−1.5\displaystyle -1.5−0.5\displaystyle -0.500.51.5
              zy\displaystyle z_y−0.5\displaystyle -0.5−1.5\displaystyle -1.50.501.5

              Work out the correlation coefficient.

                / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – check and a new line · * – times · ^ – power, ↓ – end of the power

                / – fraction bar · Tab or the arrows – between numerator and denominator, then a note above or below · Enter – a new line · * – times · ^ – power, ↓ – end of the power