Grade by Grade
D. Statistical Analysis · Two-Variable Data Analysis and Validity

The 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, xMark (%), yxyx²y²
25811643364
36218693844
570350254900
668408364624
880640646400
984756817056
Σ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.

012345678910505560657075808590Hours of study (x)Test mark, % (y)Study time and test marks: deviations from the meansx̄ = 5.5ȳ ≈ 70.3(x − x̄) > 0, (y − ȳ) < 0product negative(x − x̄) < 0, (y − ȳ) > 0product negativeproduct positiveproduct positive
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.

strongmoderateweakmoderatestrong−1−0.67−0.3300.330.671◀ negative correlationpositive correlation ▶no linear correlation near 0
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 example

Example 1: r with the computational formula

Find r for the study-time data and interpret it.

  1. Use the sums from the table: n = 6, Σx = 33, Σy = 422, Σxy = 2456, Σx² = 219, Σy² = 30 188.
  2. Numerator: nΣxy − (Σx)(Σy) = 6(2456) − 33(422) = 14 736 − 13 926 = 810.
  3. First bracket: nΣx² − (Σx)² = 6(219) − 33² = 1314 − 1089 = 225.
  4. Second bracket: nΣy² − (Σy)² = 6(30 188) − 422² = 181 128 − 178 084 = 3044.
  5. 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 example

Example 2: r with deviations

Find r for the points (1, 2), (2, 3), (3, 5), (4, 6), (5, 9) using deviations.

  1. Means: x̄ = 15 ÷ 5 = 3 and ȳ = 25 ÷ 5 = 5.
  2. x − x̄: −2, −1, 0, 1, 2. y − ȳ: −3, −2, 0, 1, 4.
  3. Products (x − x̄)(y − ȳ): 6, 2, 0, 1, 8. Sum: 17.
  4. Σ(x − x̄)² = 4 + 1 + 0 + 1 + 4 = 10. Σ(y − ȳ)² = 9 + 4 + 0 + 1 + 16 = 30.
  5. 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 example

Example 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.

  1. Numerator: 12(−5654) − (−66)(840) = −67 848 + 55 440 = −12 408.
  2. nΣx² − (Σx)² = 12(800) − (−66)² = 9600 − 4356 = 5244.
  3. nΣy² − (Σy)² = 12(61 420) − 840² = 737 040 − 705 600 = 31 440.
  4. 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 fun

Why 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 activity

r 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).

  1. Make a table with columns x, y, xy, x², y² and find the five sums.
  2. Calculate r with the computational formula. Keep all digits until the last step.
  3. Check your answer with a spreadsheet (=CORREL(...)) or Desmos.
  4. 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

1

Find r for (1, 4), (2, 6), (3, 7), (4, 10), (5, 11).

2

Find r for (10, 9), (20, 7), (30, 8), (40, 4), (50, 2).

3

Find r for (2, 5), (4, 4), (6, 7), (8, 5), (10, 8) and describe the strength.

4

A study reports r = −0.45 between daily screen time and hours of sleep for 200 teens. Interpret it.

5

Which shows the stronger linear relationship: r = −0.82 or r = 0.75?

6

Why does r have no units?

7

Every point lies exactly on the line y = 50 − 3x. What is r?

More practice: warm-up

1

What is the smallest possible value of r? The largest?

2

r = 0.12. Describe the strength.

3

A scatter plot falls to the right. Is r positive or negative?

4

Can r = 1.3?

5

In (x − x̄)(y − ȳ), what sign does a point below and to the left of (x̄, ȳ) give?

More practice: on your own

1

Find r for (3, 20), (5, 18), (6, 15), (8, 14), (9, 10), (11, 9).

2

Find r for (1, 7), (3, 5), (4, 8), (6, 4), (8, 6) and describe it.

3

For 8 pairs: Σx = 40, Σy = 60, Σxy = 320, Σx² = 240, Σy² = 500. Find r.

4

A 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?

5

Two sets of points both have r = 0.6. Must their scatter plots look the same?

Challenge

1

Show that if every y-value is replaced by −y, the value of r changes sign but keeps its size.

2

For 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?

3

All five x-values in a data set equal 7. What happens when you try to calculate r? Explain what that means.

Check your understanding

Quiz

1.

What does r measure?

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 teachers

Big 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.