D. Statistical Analysis · Two-Variable Data Analysis and ValidityThe Correlation Coefficient r: Meaning and Calculation
D2.1About 70 minutes
Learning goals- I can explain what the correlation coefficient r measures and what its sign and size tell me.
- I can explain why points in different quadrants around (x̄, ȳ) push r up or down.
- I can calculate r by hand with the formula, using a table of sums.
- I can check r with a calculator or spreadsheet and interpret it in context.
Words to know
correlation
A relationship in which two numerical variables tend to change together.
correlation coefficient (r)
A number from −1 to 1 that measures the direction and strength of the linear relationship between two numerical variables.
deviation
How far a value is from its mean, such as x − x̄.
covariance
s_xy = Σ(x − x̄)(y − ȳ) ÷ (n − 1). Positive when the variables tend to move together, negative when they move in opposite directions.
perfect correlation
r = 1 or r = −1: every point lies exactly on one straight line.
Σ (sigma)
Summation notation: Σx means "add up all the x-values".
Which relationship is stronger?
The rink data from the last lesson and the study-time data below both look "strong" on a scatter plot. Which one is stronger? Eyes are not good at this, and two people may disagree. Statisticians use one agreed number, the correlation coefficient r.
Remember from Grade 9: you found r with technology and learned that it runs from −1 to 1. Now you will learn where the number comes from and calculate it by hand. Understanding the formula helps you spot when r is being misused.
The data
Six students recorded their hours of study for a unit test and their mark.
| Hours, x | Mark (%), y | xy | x² | y² |
|---|
| 2 | 58 | 116 | 4 | 3364 |
| 3 | 62 | 186 | 9 | 3844 |
| 5 | 70 | 350 | 25 | 4900 |
| 6 | 68 | 408 | 36 | 4624 |
| 8 | 80 | 640 | 64 | 6400 |
| 9 | 84 | 756 | 81 | 7056 |
| Σx = 33 | Σy = 422 | Σxy = 2456 | Σx² = 219 | Σy² = 30 188 |
Study time and marks for six students, with the columns needed for r. (Made-up data.)The idea: deviations from the means
Draw a vertical line at the mean x̄ and a horizontal line at the mean ȳ. They split the graph into four regions. For each point, multiply its two deviations: (x − x̄)(y − ȳ).
- Points up and to the right of the centre (both deviations positive) give a positive product.
- Points down and to the left (both negative) also give a positive product.
- Points in the other two regions give negative products.
If most points sit in the two "positive" regions, the total is positive: a positive correlation. If most sit in the "negative" regions, the total is negative.
The dashed lines cross at the centre (x̄, ȳ) = (5.5, 70.3). Five of the six points are in product positive regions. Only (6, 68) is in a product negative region, and it is close to the centre, so its product is small: r will be strongly positive.From covariance to r
The average of those products is the covariance:
s_xy = Σ(x − x̄)(y − ȳ) ÷ (n − 1)
Covariance has a problem: its size depends on the units. Measure marks out of 1 instead of out of 100 and the covariance shrinks 100 times, even though the relationship has not changed. So we divide by the standard deviations s_x and s_y (you work with standard deviation in the units One-Variable Data Analysis and Continuous Distributions and the Normal Distribution):
r = s_xy ÷ (s_x · s_y)
Now r has no units, and it always lies between −1 and 1.
Working with deviations is slow when the means are not whole numbers. Some algebra gives an equivalent computational formula that uses only the sums of the raw data:
r = [nΣxy − (Σx)(Σy)] ÷ √{[nΣx² − (Σx)²][nΣy² − (Σy)²]}
Both formulas always give the same r. Use whichever is easier for the data.
A common rough guide for describing r. The sign gives the direction and the size (distance from 0) gives the strength. The cut-offs are conventions, not laws, so always look at the graph too.Worked exampleExample 1: r with the computational formula
Find r for the study-time data and interpret it.
- Use the sums from the table: n = 6, Σx = 33, Σy = 422, Σxy = 2456, Σx² = 219, Σy² = 30 188.
- Numerator: nΣxy − (Σx)(Σy) = 6(2456) − 33(422) = 14 736 − 13 926 = 810.
- First bracket: nΣx² − (Σx)² = 6(219) − 33² = 1314 − 1089 = 225.
- Second bracket: nΣy² − (Σy)² = 6(30 188) − 422² = 181 128 − 178 084 = 3044.
- r = 810 ÷ √(225 × 3044) = 810 ÷ √684 900 ≈ 810 ÷ 827.59 ≈ 0.979.
r ≈ 0.979. There is a very strong positive linear relationship: students who studied longer tended to score higher. (r alone does not prove the studying caused the higher marks; you will study this in the lesson on types of relationships.)
Worked exampleExample 2: r with deviations
Find r for the points (1, 2), (2, 3), (3, 5), (4, 6), (5, 9) using deviations.
- Means: x̄ = 15 ÷ 5 = 3 and ȳ = 25 ÷ 5 = 5.
- x − x̄: −2, −1, 0, 1, 2. y − ȳ: −3, −2, 0, 1, 4.
- Products (x − x̄)(y − ȳ): 6, 2, 0, 1, 8. Sum: 17.
- Σ(x − x̄)² = 4 + 1 + 0 + 1 + 4 = 10. Σ(y − ȳ)² = 9 + 4 + 0 + 1 + 16 = 30.
- The (n − 1) factors cancel, so r = Σ(x − x̄)(y − ȳ) ÷ √[Σ(x − x̄)² · Σ(y − ȳ)²] = 17 ÷ √300 ≈ 17 ÷ 17.32.
r ≈ 0.981, a very strong positive linear correlation.
Worked exampleExample 3: r from given sums (rink data)
For the 12 rink days, n = 12, Σx = −66, Σy = 840, Σxy = −5654, Σx² = 800, Σy² = 61 420. Find r.
- Numerator: 12(−5654) − (−66)(840) = −67 848 + 55 440 = −12 408.
- nΣx² − (Σx)² = 12(800) − (−66)² = 9600 − 4356 = 5244.
- nΣy² − (Σy)² = 12(61 420) − 840² = 737 040 − 705 600 = 31 440.
- r = −12 408 ÷ √(5244 × 31 440) ≈ −12 408 ÷ 12840.2.
r ≈ −0.966: a very strong negative linear relationship. It is slightly weaker than the study-time relationship (0.966 < 0.979), but both are very strong.
Checking with technology
- Spreadsheet:
=CORREL(A2:A7, B2:B7) gives r. - Desmos: in a table with columns x₁ and y₁, type
y_1 ~ m x_1 + b; r appears with the line. - Scientific calculators with a two-variable statistics mode (often called STAT, REG or A+BX) show r after you enter the pairs. Check your calculator's manual for the exact keys.
On a test, show the sums and the substitution so your work can be followed, then check with technology if it is allowed.
Just for funWhy did the correlation coefficient refuse to go to the party? It heard everyone would be between −1 and 1, and it had no room to stretch out.
Hands-on activityr for your arm-span data
Use the height and arm-span pairs you collected in the last lesson (or these sample data from one family: arm span 152, 160, 165, 171, 178, 183 cm; height 155, 158, 168, 170, 180, 181 cm).
- Make a table with columns x, y, xy, x², y² and find the five sums.
- Calculate r with the computational formula. Keep all digits until the last step.
- Check your answer with a spreadsheet (
=CORREL(...)) or Desmos. - Write one sentence interpreting r in context.
What to look for: for most families r is above 0.9. If your hand answer and the spreadsheet disagree, the usual culprit is a slip in Σy² (the numbers are big) or rounding the square root too early. (For the sample family, r ≈ 0.98.)
Your turn
1Find r for (1, 4), (2, 6), (3, 7), (4, 10), (5, 11).
n = 5, Σx = 15, Σy = 38, Σxy = 132, Σx² = 55, Σy² = 322. Numerator: 5(132) − (15)(38) = 90. Denominator: √[(5(55) − 15²)(5(322) − 38²)] = √(50 × 166) ≈ 91.10. r ≈ 0.988
2Find r for (10, 9), (20, 7), (30, 8), (40, 4), (50, 2).
n = 5, Σx = 150, Σy = 30, Σxy = 730, Σx² = 5 500, Σy² = 214. Numerator: 5(730) − (150)(30) = −850. Denominator: √[(5(5 500) − 150²)(5(214) − 30²)] = √(5 000 × 170) ≈ 921.95. r ≈ −0.922
3Find r for (2, 5), (4, 4), (6, 7), (8, 5), (10, 8) and describe the strength.
n = 5, Σx = 30, Σy = 29, Σxy = 188, Σx² = 220, Σy² = 179. Numerator: 5(188) − (30)(29) = 70. Denominator: √[(5(220) − 30²)(5(179) − 29²)] = √(200 × 54) ≈ 103.92. r ≈ 0.674 This is a moderate to strong positive correlation (right at the 0.67 boundary on the rough guide), so say "moderately strong" and look at the graph.
4A study reports r = −0.45 between daily screen time and hours of sleep for 200 teens. Interpret it.
A moderate negative linear relationship: teens with more screen time tended to sleep less, but there is a lot of scatter. It does not show that screens cause less sleep.
5Which shows the stronger linear relationship: r = −0.82 or r = 0.75?
r = −0.82, because |−0.82| = 0.82 is larger than 0.75. The sign only gives direction.
6Why does r have no units?
r = s_xy ÷ (s_x · s_y). The units of x and y in the covariance cancel with the units of s_x and s_y, leaving a pure number.
7Every point lies exactly on the line y = 50 − 3x. What is r?
r = −1 (a perfect negative linear relationship, because the slope is negative and every point is on the line).
More practice: warm-up
1What is the smallest possible value of r? The largest?
2r = 0.12. Describe the strength.
3A scatter plot falls to the right. Is r positive or negative?
No. r is always between −1 and 1. A value like 1.3 means a calculation error.
5In (x − x̄)(y − ȳ), what sign does a point below and to the left of (x̄, ȳ) give?
Both deviations are negative, so the product is positive.
More practice: on your own
1Find r for (3, 20), (5, 18), (6, 15), (8, 14), (9, 10), (11, 9).
n = 6, Σx = 42, Σy = 86, Σxy = 541, Σx² = 336, Σy² = 1 326. Numerator: 6(541) − (42)(86) = −366. Denominator: √[(6(336) − 42²)(6(1 326) − 86²)] = √(252 × 560) ≈ 375.66. r ≈ −0.974
2Find r for (1, 7), (3, 5), (4, 8), (6, 4), (8, 6) and describe it.
n = 5, Σx = 22, Σy = 30, Σxy = 126, Σx² = 126, Σy² = 190. Numerator: 5(126) − (22)(30) = −30. Denominator: √[(5(126) − 22²)(5(190) − 30²)] = √(146 × 50) ≈ 85.44. r ≈ −0.351 A moderate negative (borderline weak) relationship: the cloud only drifts down slightly.
3For 8 pairs: Σx = 40, Σy = 60, Σxy = 320, Σx² = 240, Σy² = 500. Find r.
Numerator: 8(320) − 40(60) = 2560 − 2400 = 160. Brackets: 8(240) − 1600 = 320 and 8(500) − 3600 = 400. r = 160 ÷ √(320 × 400) = 160 ÷ √128 000 ≈ 160 ÷ 357.77 ≈ 0.447, a moderate positive correlation.
4A student finds r = 0.94 for the heights of 12 Grade 12 students in centimetres and their masses in kilograms. A classmate redoes it with heights in metres. What r does the classmate get? Why?
r = 0.94 again. Changing units multiplies every x by the same positive number; r has no units and does not change.
5Two sets of points both have r = 0.6. Must their scatter plots look the same?
No. They could have different slopes, spreads, numbers of points, outliers or even curves. r summarizes only how closely the points fit a line, not what the graph looks like. Always graph the data.
Challenge
1Show that if every y-value is replaced by −y, the value of r changes sign but keeps its size.
Every y − ȳ changes sign, so every product (x − x̄)(y − ȳ) changes sign and the numerator becomes its opposite. The denominator uses squares, Σ(y − ȳ)², which do not change. So r becomes −r.
2For a data set, s_x = 4, s_y = 10 and the covariance is s_xy = 30. Find r. Could the covariance be 50 with these standard deviations?
r = 30 ÷ (4 × 10) = 0.75. A covariance of 50 would give r = 50 ÷ 40 = 1.25, which is impossible, so no: the covariance can be at most s_x · s_y = 40 in size.
3All five x-values in a data set equal 7. What happens when you try to calculate r? Explain what that means.
nΣx² − (Σx)² = 5(5 × 49) − 35² = 1225 − 1225 = 0, so r would divide by zero: r is undefined. If x never varies, you cannot see how y changes as x changes, so there is no correlation to measure.
Check your understandingQuiz
2. Which value of r shows the strongest linear relationship?
3. For a data set, nΣxy − ΣxΣy = −120, nΣx² − (Σx)² = 100 and nΣy² − (Σy)² = 400. What is r?
4. A point lies above and to the right of (x̄, ȳ). Its product (x − x̄)(y − ȳ) is:
5. A data set of heights in centimetres has r = 0.72 with arm span. If heights are converted to inches, r becomes:
6. Why is the covariance divided by s_x · s_y to make r?
For parents and teachersBig idea (D2.1): r is a single number from −1 to 1 that measures how closely two-variable data follow a straight line. Your teen should understand the quadrant idea (points up-right and down-left of the centre push r up) and be able to compute r carefully from a table of sums.
How to help: Ask your teen to explain the quadrant diagram to you in their own words. Then check one of their hand calculations with a spreadsheet: =CORREL(A2:A7, B2:B7).
Common difficulties:
- Mixing up Σx² (add the squares) and (Σx)² (square the sum). This is the most common error.
- Rounding the square root too early. Keep all digits until the end.
- Thinking a bigger positive number is always "stronger" than a negative one (−0.9 is stronger than 0.8).
- Treating r as the slope. r = 0.5 does not mean y rises 0.5 for each unit of x.