Warm-up
Three quick ones from earlier work. Try each in your head or on paper before you open the answer.
- The deviations of three dots from the mean x are −3, 0 and 3. What are their squares, and the sum of the squares?
Answer
9, 0 and 9, with sum 18. - From Lesson 2: the products dx × dy for four dots are 10, 1, 1 and 10. What is the covariance?
Answer
22 ÷ 4 = 5.5. - What is the square root of 144, and of 2.25?
Answer
12 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: 16 + 4 + 0 + 4 + 16.
- 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.
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
- 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.
- Step 2, the products dx × dy: 16, 2, 0, 2 and 20, which add to 40.
- Step 3, the squares of dx: 16, 4, 0, 4 and 16, which add to 40.
- Step 4, the squares of dy: 16, 1, 1, 1 and 25, which add to 44.
- 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.
Worked examples
Dots (1, 3), (2, 2), (3, 4), (4, 6) and (5, 5). Find r.
- The means are 3 and 4. dx = −2, −1, 0, 1, 2 and dy = −1, −2, 0, 2, 1.
- Products: 2, 2, 0, 2, 2 which add to 8. Squares of dx add to 10 and squares of dy add to 1 + 4 + 0 + 4 + 1 = 10.
- r = 8 ÷ √(10 × 10) = 8 ÷ 10 = 0.8, a strong positive straight-line pattern.
Dots (2, 7), (4, 13), (6, 13) and (8, 7). Find r, and describe the picture.
- The means are 5 and 10. dx = −3, −1, 1, 3 and dy = −3, 3, 3, −3.
- Products: 9, −3, 3 and −9, which add to 0. The squares of dx add to 20 and of dy to 36.
- r = 0 ÷ √(20 × 36) = 0. The dots rise and then fall, a clear arch, and still r is 0: r sees only straight lines.
Your go. The first step is given. Dots (1, 3), (2, 2), (3, 6), (4, 5) and (5, 4). Find r.
- The mean of x is 3 and the mean of y is 4.
- Write dx and dy for each dot, then the products and the two sums of squares, then divide.
Check the answer
dx = −2, −1, 0, 1, 2 and dy = −1, −2, 2, 1, 0. Products: 2, 2, 0, 1, 0, total 5. Squares of dx total 10 and of dy total 1 + 4 + 4 + 1 + 0 = 10, so r = 5 ÷ √(10 × 10) = 5 ÷ 10 = 0.5. A common slip is to take the square root of each sum, or of only one of them, and not of the product.
With a calculator
You need a square root and one product under it. Work out the product of the two sums of squares first, then press the square root key, then divide. For example, a product of 50 × 8 = 400 has a square root of 20. Keep the whole product under the root: the square root of 50 times the square root of 8 gives the same number, but the square root of 50 plus the square root of 8 does not.
Give r to two decimal places unless the root is exact, and check that your value lies between −1 and 1 and has the sign of the sum of products.
Check before you go on
1. Every y value in a data set is multiplied by −1, and the x values stay the same. What happens to r?
Your turn
Start at Level 1 and go as far as you can. Type negative numbers with a minus sign, for example -7. A wrong answer gets a reason, not just a cross: read it, then try again.
Level 1 · Getting started
2. For a data set, the sum of dx × dy is 36, the sum of dx² is 64 and the sum of dy² is 36. Find r.
3. Dots: (1, 8), (3, 9), (5, 10), (7, 12) and (9, 11). Find r. Give it as a decimal.
Level 2 · Building
4. The covariance of two variables is 12, the standard deviation of x is 4 and the standard deviation of y is 5. Find r. Give it as a decimal.
5. For a data set, the sum of dx × dy is −27, the sum of dx² is 50 and the sum of dy² is 18. Find r. Give it as a decimal.
Level 3 · Stretch
6. For a data set r = 0.7, the sum of dx² is 25 and the sum of dy² is 64. Find the sum of dx × dy.
7. A researcher has dots of x, a mass in kilograms, and y, a score. She changes x to grams (every x multiplied by 1000) and adds 5 to every y. What happens to r?
Something to think about
A student works out r for ten dots and gets 1.3. Without seeing the data, what do you know, and what is the first thing to check?
One way to think about it
r can never be above 1 or below −1, so 1.3 is certainly a slip. The likeliest places are a sum of squares that was added wrongly, or a square root that was taken of one sum instead of the product of the two, so that the denominator is too small.
Exit ticket
8. Two data sets both have a sum of dx × dy of 30 and a sum of dx² of 25. Set P has a sum of dy² of 64 and set Q has a sum of dy² of 100. Which statement is correct?