Math Core

Lesson 2.3 · Exploring Two-Variable Data

Correlation

Describing a scatterplot as "strong" or "moderate" is a judgment call, and two people looking at the same plot may disagree. The correlation rr turns the strength and direction of a linear relationship into a single number. In this lesson you'll see where that number comes from, how to interpret it, and, just as important, what it cannot tell you.

What r measures

Definition

Correlation

The correlation rr measures the direction and strength of the linear relationship between two quantitative variables. For nn individuals with values (xi,yi)(x_i, y_i),

r=1n−1∑(xi−xˉsx)(yi−yˉsy)=1n−1∑zxi zyir = \frac{1}{n - 1} \sum \left( \frac{x_i - \bar{x}}{s_x} \right) \left( \frac{y_i - \bar{y}}{s_y} \right) = \frac{1}{n - 1} \sum z_{x_i} \, z_{y_i}

where xˉ\bar{x}, sxs_x, yˉ\bar{y} and sys_y are the means and standard deviations of the two variables.

In words: standardize every xx and every yy, multiply each individual's pair of z-scores, add up the products, and divide by n−1n - 1.

Why does this work? An individual that is above average in both variables has two positive z-scores, so its product is positive. An individual below average in both has two negative z-scores, and the product is again positive. Individuals that are above average in one variable and below in the other contribute negative products. So when most points lie in the lower-left and upper-right regions around (xˉ,yˉ)(\bar{x}, \bar{y}), the sum is positive; when most lie in the upper-left and lower-right, it is negative.

Worked example: Computing r by hand

Find the correlation for the five points (1,2)(1, 2), (2,4)(2, 4), (3,3)(3, 3), (4,6)(4, 6), (5,5)(5, 5).

First the summary statistics: xˉ=3\bar{x} = 3 and yˉ=4\bar{y} = 4. The deviations of xx are −2,−1,0,1,2-2, -1, 0, 1, 2, so sx=4+1+0+1+44=2.5≈1.581s_x = \sqrt{\dfrac{4 + 1 + 0 + 1 + 4}{4}} = \sqrt{2.5} \approx 1.581. The deviations of yy are −2,0,−1,2,1-2, 0, -1, 2, 1, so sy=2.5≈1.581s_y = \sqrt{2.5} \approx 1.581 as well.

xxyyzxz_xzyz_yzxzyz_x z_y
1122−1.265-1.265−1.265-1.2651.61.6
2244−0.632-0.6320000
333300−0.632-0.63200
44660.6320.6321.2651.2650.80.8
55551.2651.2650.6320.6320.80.8

The products add to 1.6+0+0+0.8+0.8=3.21.6 + 0 + 0 + 0.8 + 0.8 = 3.2, so

r=3.25−1=0.8.r = \frac{3.2}{5 - 1} = 0.8.

In practice you'll use a calculator (on a TI-84, turn on diagnostics and run LinReg), but doing one by hand shows exactly what rr is adding up.

Interpreting r

The correlation is always between −1-1 and 11.

  • The sign gives the direction. Positive rr means a positive association.
  • The magnitude gives the strength. Values near −1-1 or 11 mean the points lie close to a line; r=±1r = \pm 1 only when every point lies exactly on a line. Values near 00 mean a weak linear relationship.

An interpretation on the AP exam should mention strength, direction, "linear," and the context. For the example above: "The correlation of r=0.8r = 0.8 indicates a fairly strong, positive, linear association between xx and yy."

The three plots below show how scatter relates to rr.

r ≈ −0.99: points hug a falling line.Open in grapher →
r ≈ 0.59: a rising trend with a lot of scatter.Open in grapher →
r ≈ 0.09: essentially no linear association.Open in grapher →

Common mistake

Strength is about ∣r∣\lvert r \rvert, not the sign. A correlation of r=−0.85r = -0.85 is stronger than r=0.70r = 0.70. Also, rr is not a percent and not a slope: r=0.5r = 0.5 does not mean "50%50\% related," and a nearly flat line can have rr close to 11.

Properties of correlation

Because rr is built from z-scores, several facts follow directly from the formula.

  • Roles don't matter. Swapping xx and yy swaps the two factors in each product, which doesn't change the sum. The correlation of height with weight equals the correlation of weight with height.
  • Units don't matter. Z-scores have no units, so rr has no units. Converting inches to centimeters or Fahrenheit to Celsius leaves rr unchanged.
  • Positive linear changes don't matter. Adding a constant to every value, or multiplying every value by a positive constant, does not change any z-score. Multiplying one variable by a negative constant flips the sign of each of its z-scores, so rr changes sign.
  • rr is not resistant. It is built from means and standard deviations, which outliers pull strongly. One unusual point can make rr much larger or much smaller.

Worked example: Transforming a variable

For a group of adults, the correlation between daily temperature in °F and electricity use is r=0.62r = 0.62. Find the new correlation if (a) temperature is converted to Celsius using C=59(F−32)C = \frac{5}{9}(F - 32), and (b) the analyst instead uses "degrees below 100100°F," computed as D=100−FD = 100 - F.

(a) Celsius is a positive multiple of FF plus a constant, so every z-score is unchanged: r=0.62r = 0.62.

(b) D=−1⋅F+100D = -1 \cdot F + 100 multiplies FF by a negative number, which flips the sign of every temperature z-score: r=−0.62r = -0.62. The relationship has the same strength; only the direction of the scale reversed.

Worked example: One point changes r

The eight points (1,3)(1, 3), (2,4)(2, 4), (3,6)(3, 6), (4,6)(4, 6), (5,8)(5, 8), (6,9)(6, 9), (7,10)(7, 10), (8,12)(8, 12) have r≈0.99r \approx 0.99. What happens when the point (4.5,15)(4.5, 15) is added?

The point (4.5, 15) sits far above an otherwise tight linear pattern.Open in grapher →

With the new point, a calculator gives r≈0.74r \approx 0.74. The eight original points are still nearly collinear. The new point sits at x=4.5x = 4.5, exactly at xˉ\bar{x}, so its zx=0z_x = 0 and it adds nothing to the sum of products. But it is far above the other points, so it inflates sys_y, which shrinks every other point's zyz_y. The correlation drops sharply. Always report whether a conclusion depends on one unusual point.

What r can't tell you

Correlation has limits

  1. rr only describes linear relationships. A strong curved relationship can have rr near 00, and a curved relationship can also have rr near 11. Always look at the scatterplot first.
  2. Correlation does not imply causation. A strong rr in observational data can come from a lurking variable that drives both variables. Only a well-designed randomized experiment can establish cause and effect.
  3. rr requires two quantitative variables. There is no correlation between gender and favorite sport; use a two-way table instead.

A classic example of the second point: across elementary schools, shoe size and reading level are strongly correlated. Bigger feet don't cause better reading. Age is the lurking variable: older children have bigger feet and read better.

Tip

Estimating rr from a plot: first decide the sign from the direction. Then imagine an oval drawn tightly around the points. A thin, pencil-like oval means ∣r∣\lvert r \rvert near 11; a fat, nearly round oval means ∣r∣\lvert r \rvert near 00.

Practice

Practice 1

Which correlation indicates the strongest linear relationship?

Practice 2

Find the correlation, to two decimal places, for the points (2,9)(2, 9), (4,7)(4, 7), (6,8)(6, 8), (8,4)(8, 4), (10,2)(10, 2).

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 3

For 2525 students, the correlation between hours of sleep and reaction time (in milliseconds) is r=−0.54r = -0.54. Which is the best interpretation?

Practice 4

The correlation between the weights of 4040 packages in pounds and their shipping costs in dollars is r=0.71r = 0.71. Every weight is converted to kilograms (multiply by 0.45360.4536) and a $2 handling fee is added to every cost. What is the new correlation?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 5

A study finds that the correlation between a car's age xx (years) and its value yy (dollars) is r=−0.4r = -0.4. What is the correlation if the roles are switched, with value on the xx-axis and age on the yy-axis?

Enter a number. Fractions like 3/4 and sqrt(2) are OK.

Practice 6

A scatterplot shows a clear U-shaped pattern, and a student computes r=0.04r = 0.04. Which conclusion is correct?

Practice 7

Across 5050 U.S. cities, the number of hospitals and the number of deaths per year have a correlation of r=0.93r = 0.93. Which statement is most reasonable?

Practice 8

Eight points lie very close to a rising line and have r=0.97r = 0.97. A ninth point is added far to the right, exactly on the extension of that line. What is the most likely effect on rr?