KS Maths
Year 11 Extended · Unit 5 Sampling, correlation and regression · Lesson 3 of 5

The correlation coefficient by formula

The correlation coefficient r, worked out by formula once

Covariance carries the units of the data, so its size means little. Divide it by the spread of x and the spread of y and the units cancel, leaving r between −1 and 1. This lesson builds r from the deviations, by hand, once, so that the number a calculator gives stops being a mystery.

Statistics and ProbabilityScientific calculator

Words you need (10 key words in this lesson)

The maths words this lesson uses, in plain English. Open this before you start if English is not your first language.

coefficient
The number multiplied by a letter in a term.In 7x, the coefficient is 7.
correlation
How strongly two sets of data are linked.Hours of study and test scores show positive correlation.
formula
A rule using letters that shows how to work something out.Area = length times width is a formula.
square
Multiply a number by itself. Also, a shape with four equal sides and four right angles.5 squared is 25.
mean
The total of all values divided by how many values there are.The mean of 2, 4, 6 is 4.
standard deviation
A number that shows how far data are from the mean on average.A small standard deviation means data are close together.
square root
A number that gives the original number when multiplied by itself.The square root of 25 is 5.
decimal place
A digit after the decimal point. We count places from the point.3.14 has two decimal places.
straight line
A line that does not bend.A ruler draws a straight line.
add
Put numbers together to find the total.Add 3 and 4 to get 7.

Preview You are reading the start of this lesson. The rest opens with a plan. See plans Already paid? Sign in

Warm-up

Three quick ones from earlier work. Try each in your head or on paper before you open the answer.

  1. From Year 10 (standard deviation): the deviations of three dots from the mean x are −3, 0 and 3. What are their squares, and the sum of the squares?
    Answer9, 0 and 9, with sum 18.
  2. From Lesson 2: the products dx × dy for four dots are 10, 1, 1 and 10. What is the covariance?
    Answer22 ÷ 4 = 5.5.
  3. From Year 7: what is the square root of 144, and of 2.25?
    Answer12 and 1.5.
Words used in this lesson
correlation coefficient
a number between −1 and 1 that measures how closely dots follow a straight line. For example: r = 0.3 for dots in a loose, rising cloud.
sum of squares
the total of the squares of the deviations. For example: 1 + 0 + 1 + 9 = 11.
standard deviation
the typical size of a deviation: the square root of the mean of the squares. For example: the spread of x in hours.
strength
how closely the dots follow a straight line, the size of r without the sign. For example: 0.8 is stronger than 0.3.
direction
whether y tends to rise or fall as x rises, shown by the sign of r. For example: negative: y falls as x rises.

From covariance to r

In Lesson 2 the five stalls had a covariance of 8, but that number is in units of hours times hundreds of loaves, and in single loaves it would be 800. To compare links we divide out the units. The tool is the spread of each variable, measured from its mean point by the sums of squared deviations.

Predict first: before the figure shows any sums, will r for the five stalls be close to 1, about a half, or close to 0? Then step through the five columns and see whether you were right.

x246810y255711dx−4−2024dy−4−1−115total
not yetsum of dx times dy
not yetsum of dx squared
not yetsum of dy squared
not yetr, to two decimal places

Step 1, the deviations: dx = x − 6 and dy = y − 6 for each of the five dots. Nothing has been multiplied yet.

Show me the steps
  1. Step 1, the deviations: dx = x − 6 is −4, −2, 0, 2, 4 and dy = y − 6 is −4, −1, −1, 1, 5. The mean of x and the mean of y are both 6.
  2. Step 2, the products dx × dy: 16, 2, 0, 2 and 20, which add to 40.
  3. Step 3, the squares of dx: 16, 4, 0, 4 and 16, which add to 40.
  4. Step 4, the squares of dy: 16, 1, 1, 1 and 25, which add to 44.
  5. Step 5: r = 40 ÷ √(40 × 44) = 40 ÷ √1760 = 0.95 to two decimal places. Flip to the falling pattern (the same y values in reverse order): the total of the products becomes −40, the two sums of squares are still 40 and 44, and r = −0.95.

r = Σ(dx × dy) ÷ √[ Σ(dx²) × Σ(dy²) ].

  • The top is the sum of the products from Lesson 2. The bottom is the square root of the two sums of squares multiplied together, taken as one square root.
  • It is the covariance divided by the standard deviation of x and the standard deviation of y: the number of dots cancels, and so do the units.
  • r always lies between −1 and 1. Its sign is the sign of the sum of products. r has no units, so it is the same in cm or in m.
  • r measures the strength of a straight-line pattern only. r = 0 does not say the dots have no pattern.
Why r can never pass 1 or −1

Write A = √Σ(dx²) and B = √Σ(dy²). A total of squares is never negative, so Σ(dx ÷ A − dy ÷ B)² ≥ 0. Expanded, its three parts are Σ(dx²) ÷ A² = 1, then −2 × Σ(dx × dy) ÷ (AB) = −2r, then Σ(dy²) ÷ B² = 1. So 2 − 2r ≥ 0, and r ≤ 1. With + in place of − the same steps give r ≥ −1. r = 1 only when every dx ÷ A equals dy ÷ B: the dots lie exactly on a rising line.

r is not a percentage and not proof of cause. An r of 0.8 does not mean “80% of the dots are on the line”, and it does not say that x makes y change. It says how closely the dots follow some straight line, and nothing more. A single dot far from the rest can move r a great deal, so look at the graph as well as the number.

The rest of this lesson is in the full course

Still to come in this lesson:

  • Worked examples
  • Check before you go on
  • Your turn

In the full lesson every figure moves as you drag it, and every answer you type is checked, with a note on what each wrong answer means.

Years 7 to 11 plan$59Every lesson from Year 7 to Year 11, so the refresher links always open, and every Year 7 to 11 revision pack, for the whole family. $59 for 12 months or $99 for 2 years.
IB Diploma plan$99Every lesson from Year 7 to the IB Diploma, AA and AI, SL and HL, for the whole family. $99 for 12 months or $149 for 2 years.

One plan opens every Diploma lesson, AA and AI, SL and HL, for the whole family.

One payment. Nothing renews. Full refund within 30 days. Prices are in US$; Gumroad shows your local currency at checkout. Pay by card on Gumroad, then come back here and type the email you paid with: we email you a sign-in link. For a refund, reply to your Gumroad receipt or email hello@ksmaths.com.

Try a free sample lesson in every unit, and the whole Skill Tree. See this unit.

Already have a revision pack or the Years 7 to 11 plan? Move up and the unused part of what you paid comes off.

Teaching students who need extra support? Student codes for 5, 10 or 30 students.

Year 11 revision pack, $19BuyPlan $59