StatisticsExploring Two-Variable Data3 of 8
Exploring Two-Variable Data · 3

Correlation

Words like "strong" or "weak" are too fuzzy to compare scatterplots by eye, so we need a single number that measures the direction and strength of a linear relationship.

1

Measuring How Variables Move Together

The correlation rr is a single number that measures how closely two quantitative variables follow a straight line. To build it, we first mark the center of the scatterplot at the mean of the horizontal values and the mean of the vertical values, (xˉ,yˉ)\centre{(\bar{x}, \bar{y})}, which splits the graph into four quadrants.

Quadrants and Products of Steps from the Mean
monthly rent\htmlClass{lc-ink}{\text{monthly rent}}
apartment size\htmlClass{lc-ink}{\text{apartment size}}
puzzle speed\htmlClass{lc-ink}{\text{puzzle speed}}
hours of sleep\htmlClass{lc-ink}{\text{hours of sleep}}

From the center (xˉ,yˉ)\centre{(\bar{x}, \bar{y})}, every point (x,y)\data{(x, y)} has a horizontal step x−xˉ\data{x} - \centre{\bar{x}} and a vertical step y−yˉ\data{y} - \centre{\bar{y}}. Multiplying those two steps gives the signed area of the rectangle between the point and the center:

(x−xˉ)⏟horizontal step⋅(y−yˉ)⏟vertical step={(+)in the top-right (+)(+) and bottom-left (−)(−)(−)in the top-left (−)(+) and bottom-right (+)(−)\displaystyle \begin{aligned} &\underbrace{(\data{x} - \centre{\bar{x}})}_{\text{horizontal step}} \cdot \underbrace{(\data{y} - \centre{\bar{y}})}_{\text{vertical step}} = \\ &\begin{cases} \positive{(+)} & \text{in the top-right } (\step{+})(\step{+}) \\ & \text{ and bottom-left } (\step{-})(\step{-}) \\ \negative{(-)} & \text{in the top-left } (\step{-})(\step{+}) \\ & \text{ and bottom-right } (\step{+})(\step{-}) \end{cases} \end{aligned}

Now let's test how those positive and negative rectangles add up across a cloud of points.

A point's horizontal and vertical steps from the center make a rectangle whose area is positive when both steps have the same sign, and negative when their signs are opposite.
2

Standardizing Steps with Z-Scores

Multiplying the raw steps (x−xˉ)(y−yˉ)(\data{x} - \centre{\bar{x}})(\data{y} - \centre{\bar{y}}) has a problem: if we change apartment size from square meters to square feet, the steps and their products get much larger even though the relationship hasn't changed at all. To remove the units before we multiply, we divide each step by its sample standard deviation (sx\step{s_x} or sy\step{s_y}) to turn every coordinate into a z-score:

zx\displaystyle \step{z_x} =x−xˉsx,zy\displaystyle = \frac{\data{x} - \centre{\bar{x}}}{\step{s_x}}, \qquad \step{z_y} =y−yˉsy\displaystyle = \frac{\data{y} - \centre{\bar{y}}}{\step{s_y}}
Standardizing with Z-Scores to Define Correlation r
rent\htmlClass{lc-ink}{\text{rent}}
size\htmlClass{lc-ink}{\text{size}}
xˉ\htmlClass{lc-violet}{\bar{x}}
yˉ\htmlClass{lc-violet}{\bar{y}}

Once every point is written in standard deviations from the center as (zx,zy)\step{(z_x, z_y)}, we multiply zxzy\step{z_x z_y} for each point and average them by dividing by n−1n - 1 (matching the n−1n - 1 used inside sx\step{s_x} and sy\step{s_y}):

r\displaystyle r =∑zxzyn−1\displaystyle = \frac{\sum \step{z_x z_y}}{n - 1}

Because the average of z2\step{z}^2 across any dataset is ∑z2n−1=1\frac{\sum \step{z}^2}{n - 1} = 1, the correlation rr can never go past +1\positive{+}1 or −1\negative{-}1:

−1\displaystyle \negative{-}1 ≤r\displaystyle \le r ≤+1\displaystyle \le \positive{+}1
zx\htmlClass{lc-pink}{z_x}
zy\htmlClass{lc-pink}{z_y}
r=+1.0r = \htmlClass{lc-blue}{+}1.0
zy=zx\htmlClass{lc-pink}{z_y} = \htmlClass{lc-pink}{z_x}
zx\htmlClass{lc-pink}{z_x}
zy\htmlClass{lc-pink}{z_y}
r=0r = 0
zx\htmlClass{lc-pink}{z_x}
zy\htmlClass{lc-pink}{z_y}
r=−1.0r = \htmlClass{lc-orange}{-}1.0
zy=−zx\htmlClass{lc-pink}{z_y} = -\htmlClass{lc-pink}{z_x}

Note that the −\negative{-} sign on rr only tells you the line slopes downhill, not that the relationship is weaker. An rr of −0.95\negative{-}0.95 is a much stronger linear relationship than +0.60\positive{+}0.60.

3

Calculating Correlation Step by Step

Now let's calculate rr from raw data for n=5n = 5 students, comparing hours studied (x\data{x}) and quiz score out of 10 (y\data{y}):

A (1,2),B (3,6),C (5,4),D (5,6),E (6,7)\displaystyle \begin{aligned} &\text{A }\data{(1, 2)}, \quad \text{B }\data{(3, 6)}, \quad \text{C }\data{(5, 4)}, \\ &\text{D }\data{(5, 6)}, \quad \text{E }\data{(6, 7)} \end{aligned}
Calculating Correlation Step by Step
0\htmlClass{lc-ink}{0}
2\htmlClass{lc-ink}{2}
4\htmlClass{lc-ink}{4}
6\htmlClass{lc-ink}{6}
8\htmlClass{lc-ink}{8}
2\htmlClass{lc-ink}{2}
4\htmlClass{lc-ink}{4}
6\htmlClass{lc-ink}{6}
8\htmlClass{lc-ink}{8}
quiz score\htmlClass{lc-ink}{\text{quiz score}}
hours studied\htmlClass{lc-ink}{\text{hours studied}}
x\htmlClass{lc-blue}{x}y\htmlClass{lc-blue}{y}
A\htmlClass{lc-ink}{\text{A}}1\htmlClass{lc-blue}{1}2\htmlClass{lc-blue}{2}
B\htmlClass{lc-ink}{\text{B}}3\htmlClass{lc-blue}{3}6\htmlClass{lc-blue}{6}
C\htmlClass{lc-ink}{\text{C}}5\htmlClass{lc-blue}{5}4\htmlClass{lc-blue}{4}
D\htmlClass{lc-ink}{\text{D}}5\htmlClass{lc-blue}{5}6\htmlClass{lc-blue}{6}
E\htmlClass{lc-ink}{\text{E}}6\htmlClass{lc-blue}{6}7\htmlClass{lc-blue}{7}
A\htmlClass{lc-ink}{\text{A}}
B\htmlClass{lc-ink}{\text{B}}
C\htmlClass{lc-ink}{\text{C}}
D\htmlClass{lc-ink}{\text{D}}
E\htmlClass{lc-ink}{\text{E}}
Text solution
1. Find the center (xˉ,yˉ)\centre{(\bar{x}, \bar{y})} from the two meansAverage the 5 horizontal values and the 5 vertical values to find the center of the cloud.
xˉ\displaystyle \centre{\bar{x}} =1+3+5+5+65\displaystyle = \frac{\data{1} + \data{3} + \data{5} + \data{5} + \data{6}}{5} =205\displaystyle = \frac{20}{5} =4 hours\displaystyle = \centre{4}\text{ hours}
yˉ\displaystyle \centre{\bar{y}} =2+6+4+6+75\displaystyle = \frac{\data{2} + \data{6} + \data{4} + \data{6} + \data{7}}{5} =255\displaystyle = \frac{25}{5} =5 points\displaystyle = \centre{5}\text{ points}
2. Find the sample standard deviations sx\step{s_x} and sy\step{s_y}Square each point's deviations from the mean, add them up, divide by n−1=4n - 1 = 4, and take the square root.
sx\displaystyle \step{s_x} =(−3)2+(−1)2+12+12+225−1\displaystyle = \sqrt{\frac{(\step{-3})^2 + (\step{-1})^2 + \step{1}^2 + \step{1}^2 + \step{2}^2}{5 - 1}} =164\displaystyle = \sqrt{\frac{16}{4}} =4\displaystyle = \sqrt{4} =2 hours\displaystyle = \step{2}\text{ hours}
sy\displaystyle \step{s_y} =(−3)2+12+(−1)2+12+225−1\displaystyle = \sqrt{\frac{(\step{-3})^2 + \step{1}^2 + (\step{-1})^2 + \step{1}^2 + \step{2}^2}{5 - 1}} =164\displaystyle = \sqrt{\frac{16}{4}} =4\displaystyle = \sqrt{4} =2 points\displaystyle = \step{2}\text{ points}
3. Convert each point to z-scores and multiply zxzy\step{z_x z_y}Divide each deviation by its standard deviation to get (zx,zy)\step{(z_x, z_y)} and multiply the pair for each student.
A (1,2):zxzy\displaystyle \text{A }\data{(1, 2)}: \quad \step{z_x z_y} =(1−42)(2−52)\displaystyle = \left(\frac{\data{1} - \centre{4}}{\step{2}}\right)\left(\frac{\data{2} - \centre{5}}{\step{2}}\right) =(−1.5)(−1.5)\displaystyle = (\step{-1.5})(\step{-1.5}) =+2.25\displaystyle = \positive{+2.25}
B (3,6):zxzy\displaystyle \text{B }\data{(3, 6)}: \quad \step{z_x z_y} =(3−42)(6−52)\displaystyle = \left(\frac{\data{3} - \centre{4}}{\step{2}}\right)\left(\frac{\data{6} - \centre{5}}{\step{2}}\right) =(−0.5)(+0.5)\displaystyle = (\step{-0.5})(\step{+0.5}) =−0.25\displaystyle = \negative{-0.25}
C (5,4):zxzy\displaystyle \text{C }\data{(5, 4)}: \quad \step{z_x z_y} =(5−42)(4−52)\displaystyle = \left(\frac{\data{5} - \centre{4}}{\step{2}}\right)\left(\frac{\data{4} - \centre{5}}{\step{2}}\right) =(+0.5)(−0.5)\displaystyle = (\step{+0.5})(\step{-0.5}) =−0.25\displaystyle = \negative{-0.25}
D (5,6):zxzy\displaystyle \text{D }\data{(5, 6)}: \quad \step{z_x z_y} =(5−42)(6−52)\displaystyle = \left(\frac{\data{5} - \centre{4}}{\step{2}}\right)\left(\frac{\data{6} - \centre{5}}{\step{2}}\right) =(+0.5)(+0.5)\displaystyle = (\step{+0.5})(\step{+0.5}) =+0.25\displaystyle = \positive{+0.25}
E (6,7):zxzy\displaystyle \text{E }\data{(6, 7)}: \quad \step{z_x z_y} =(6−42)(7−52)\displaystyle = \left(\frac{\data{6} - \centre{4}}{\step{2}}\right)\left(\frac{\data{7} - \centre{5}}{\step{2}}\right) =(+1.0)(+1.0)\displaystyle = (\step{+1.0})(\step{+1.0}) =+1.00\displaystyle = \positive{+1.00}
4. Add the z-score products and divide by n−1n - 1Three points in the top-right and bottom-left quadrants add positive products while two in the other quadrants subtract a little, leaving a positive average.
r\displaystyle r =2.25−0.25−0.25+0.25+1.005−1\displaystyle = \frac{\positive{2.25} - \negative{0.25} - \negative{0.25} + \positive{0.25} + \positive{1.00}}{5 - 1} =3.004\displaystyle = \frac{3.00}{4} =+0.75\displaystyle = \positive{+}0.75

So r=+0.75r = \positive{+}0.75, which tells us the five students' hours studied and quiz scores have a moderately strong, positive linear relationship.

4

How Changing Axes or Units Affects rr

Because rr is built purely from multiplied z-scores, we can see right away what happens to rr when we swap the axes, change the units of measurement, or stretch the graph vertically.

Key Properties of Correlation
0\htmlClass{lc-ink}{0}
2\htmlClass{lc-ink}{2}
4\htmlClass{lc-ink}{4}
6\htmlClass{lc-ink}{6}
8\htmlClass{lc-ink}{8}
2\htmlClass{lc-ink}{2}
4\htmlClass{lc-ink}{4}
6\htmlClass{lc-ink}{6}
8\htmlClass{lc-ink}{8}
quiz score\htmlClass{lc-ink}{\text{quiz score}}
hours studied\htmlClass{lc-ink}{\text{hours studied}}
r=∑zxzyn−1r = \dfrac{\sum \htmlClass{lc-pink}{z_x}\htmlClass{lc-pink}{z_y}}{n - 1}
r=+0.75r = \htmlClass{lc-blue}{+}0.75

Each property comes straight from the formula r=∑zxzyn−1r = \frac{\sum \step{z_x z_y}}{n - 1}:

If you stretch or squish the vertical axis so the cloud looks steeper or flatter, yˉ\centre{\bar{y}} and sy\step{s_y} scale by the exact same factor, so the (zx,zy)\step{(z_x, z_y)} plot and rr don't change at all.

Stretching or squishing the vertical scale changes the cloud's steepness, vertical average, and vertical spread together, leaving every z-score and the correlation unchanged.
5

Matching Scatterplots to rr and Interpreting in Context

To match scatterplots to their correlation values, or to write an interpretation of rr for a real dataset, we read the sign and the size of rr one at a time.

r=+0.75r = \htmlClass{lc-blue}{+}0.75
r=−0.92r = \htmlClass{lc-orange}{-}0.92
r=+0.98r = \htmlClass{lc-blue}{+}0.98
r=−0.15r = \htmlClass{lc-orange}{-}0.15
Matching Scatterplots to r and Interpreting Correlation
r= ?r = \,?
r= ?r = \,?
r= ?r = \,?
r= ?r = \,?
−0.92,+0.75,−0.15,+0.98\htmlClass{lc-orange}{-}0.92,\quad \htmlClass{lc-blue}{+}0.75,\quad \htmlClass{lc-orange}{-}0.15,\quad \htmlClass{lc-blue}{+}0.98
Text solution
1. Group by sign for directionPair the positive rr values with the uphill scatterplots and the negative rr values with the downhill scatterplots.
Uphill (+):r=+0.75, +0.98Downhill (−):r=−0.15, −0.92\displaystyle \begin{aligned} \text{Uphill } (\positive{+}): &\quad r = \positive{+}0.75, \ \positive{+}0.98 \\ \text{Downhill } (\negative{-}): &\quad r = \negative{-}0.15, \ \negative{-}0.92 \end{aligned}
2. Rank by distance from 00 toward ±1\pm 1 for tightnessWithin each pair, match the value closer to +1\positive{+}1 or −1\negative{-}1 to the tighter linear cloud and the value closer to 00 to the looser cloud.
+0.98⏟tighter uphill>+0.75⏟looser uphill,∣−0.92∣⏟tighter downhill>∣−0.15∣⏟nearly round cloud\displaystyle \begin{aligned} \underbrace{\positive{+}0.98}_{\text{tighter uphill}} &> \underbrace{\positive{+}0.75}_{\text{looser uphill}}, \\[8pt] \underbrace{\left|\negative{-}0.92\right|}_{\text{tighter downhill}} &> \underbrace{\left|\negative{-}0.15\right|}_{\text{nearly round cloud}} \end{aligned}

When a question asks you to interpret r=+0.75r = \positive{+}0.75, don't just write "moderately strong positive correlation." Connect the strength (from the size 0.750.75), the direction (from the +\positive{+} sign), the linear form, and both variables in context:

> An rr of +0.75\positive{+}0.75 indicates a moderately strong, positive, linear association between hours studied and quiz score: students who studied more hours tended to earn higher scores on the quiz.

6

What Can Fool Correlation: Curves, Outliers, and Lurking Variables

Because rr summarizes an entire scatterplot as a single average, three situations can mislead you if you don't check the graph and the context first.

What Can Fool Correlation: Curves, Outliers, and Lurking Variables
growth\htmlClass{lc-ink}{\text{growth}}
water\htmlClass{lc-ink}{\text{water}}
r= ?r = \,?
xˉ\htmlClass{lc-violet}{\bar{x}}
yˉ\htmlClass{lc-violet}{\bar{y}}
water\htmlClass{lc-ink}{\text{water}}
growth\htmlClass{lc-ink}{\text{growth}}
r=0r = 0

Let's see how a single outlier in the top-left or bottom-right quadrant can pull the correlation of a tight uphill cluster down near zero.

One far-off point in an opposite quadrant makes a negative rectangle big enough to cancel out a whole uphill cluster and pull the correlation near zero.

Key concepts

Before calculating or trusting a correlation rr, check two conditions: both variables must be quantitative (never use rr if a variable is categorical like species name), and the scatterplot should follow a linear pattern without extreme outliers (never use r=0r = 0 to claim two variables are unrelated when the graph is curved).

To find rr, measure each point's step from the center (xˉ,yˉ)\centre{(\bar{x}, \bar{y})} in standard deviations, multiply each pair of z-scores, and average by n−1n - 1:

zx=x−xˉsx,zy=y−yˉsy,r=∑zxzyn−1\displaystyle \begin{aligned} \step{z_x} &= \frac{\data{x} - \centre{\bar{x}}}{\step{s_x}}, \\ \step{z_y} &= \frac{\data{y} - \centre{\bar{y}}}{\step{s_y}}, \\ r &= \frac{\sum \step{z_x z_y}}{n - 1} \end{aligned}
Quadrant signs determine the sum

A point with zx=−1.5\step{z_x} = \step{-1.5} and zy=−1.5\step{z_y} = \step{-1.5} sits in the bottom-left quadrant and adds (−1.5)(−1.5)=+2.25(\step{-1.5})(\step{-1.5}) = \positive{+2.25}, pulling rr toward a positive (uphill) value, while a top-left point like (−2.0,+2.0)(\step{-2.0}, \step{+2.0}) adds −4.00\negative{-4.00} and pulls rr down.

Sign for direction, size for tightness (−1≤r≤+1\negative{-}1 \le r \le \positive{+}1)

r=−0.94r = \negative{-}0.94 is a much tighter linear cluster than r=+0.72r = \positive{+}0.72 because ∣−0.94∣\left|\negative{-}0.94\right| is closer to 11; the −\negative{-} sign only tells you the line slopes downhill.

Unitless, symmetric, and unaffected by slope

Converting units (meters to feet), swapping the x\data{x} and y\data{y} axes, or stretching an axis leaves every zxzy\step{z_x z_y} product and rr completely unchanged.

Association, not causation

Even a strong correlation like r=+0.82r = \positive{+}0.82 only means x\data{x} and y\data{y} move together around their means, never that x\data{x} causes y\data{y}; always check whether a lurking variable causes both.

7

Practice

1

Match each scatterplot description (A, B, C, D) to its correlation value from the list r=−0.94r = \negative{-}0.94, r=−0.18r = \negative{-}0.18, r=+0.72r = \positive{+}0.72, and r=+0.99r = \positive{+}0.99: (A) dots rise from left to right in a moderately tight linear cloud; (B) a nearly circular cloud of dots with a faint downward drift; (C) dots fall from left to right, clustered tightly around a straight line; (D) dots lie almost perfectly on an uphill straight line.

Split the four numbers into two pairs by their sign (+\positive{+} or −\negative{-}) first, then compare how close each number in the pair is to 11 or −1\negative{-}1.

First group by sign for direction: the uphill clouds (A and D) must match +0.72\positive{+}0.72 and +0.99\positive{+}0.99, and the downhill clouds (B and C) must match −0.18\negative{-}0.18 and −0.94\negative{-}0.94. Next compare distance from 00 for tightness. Watch out for the common mistake of treating −0.94\negative{-}0.94 as weaker than −0.18\negative{-}0.18 because −0.94<−0.18\negative{-}0.94 < \negative{-}0.18 on a number line, which swaps B and C. Strength comes from the size ∣−0.94∣=0.94>∣−0.18∣=0.18\left|\negative{-}0.94\right| = 0.94 > \left|\negative{-}0.18\right| = 0.18. A matches r=+0.72r = \positive{+}0.72, B matches r=−0.18r = \negative{-}0.18, C matches r=−0.94r = \negative{-}0.94, and D matches r=+0.99r = \positive{+}0.99.
2

For a sample of used cars, age x\data{x} has mean xˉ=5 years\centre{\bar{x}} = \centre{5}\text{ years} and standard deviation sx=2 years\step{s_x} = \step{2}\text{ years}, and price y\data{y} has mean yˉ=$14,000\centre{\bar{y}} = \centre{\$14{,}000} and standard deviation sy=$3,000\step{s_y} = \step{\$3{,}000}. One car in the sample is 1 year\data{1}\text{ year} old and sells for $20,000\data{\$20{,}000}. Find zx\step{z_x}, zy\step{z_y}, and the product zxzy\step{z_x z_y} for this car, state which quadrant it sits in relative to (xˉ,yˉ)\centre{(\bar{x}, \bar{y})}, and explain how it affects the correlation rr.

Find the signed step from the mean (x−xˉ\data{x} - \centre{\bar{x}} and y−yˉ\data{y} - \centre{\bar{y}}) first, then divide each by its standard deviation.

Find the z-scores for the car's age x=1\data{x} = \data{1} and price y=20,000\data{y} = \data{20{,}000} (watch out: subtract value−mean\data{\text{value}} - \centre{\text{mean}}, not mean−value\centre{\text{mean}} - \data{\text{value}}; doing 5−15 - 1 gives zx=+2.0z_x = +2.0, which puts the car in the wrong quadrant and flips the product to +4.0+4.0):
zx=1−52=−2.0,zy=20,000−14,0003,000=+2.0\displaystyle \begin{aligned} \step{z_x} &= \frac{\data{1} - \centre{5}}{\step{2}} = \step{-2.0}, \\ \step{z_y} &= \frac{\data{20{,}000} - \centre{14{,}000}}{\step{3{,}000}} = \step{+2.0} \end{aligned}
Multiply the z-scores:
zxzy\displaystyle \step{z_x z_y} =(−2.0)(+2.0)\displaystyle = (\step{-2.0})(\step{+2.0}) =−4.0\displaystyle = \negative{-4.0}
zx=−2.0\step{z_x} = \step{-2.0}, zy=+2.0\step{z_y} = \step{+2.0}, and zxzy=−4.0\step{z_x z_y} = \negative{-4.0}; because zx<0\step{z_x} < 0 and zy>0\step{z_y} > 0, the car sits in the top-left quadrant relative to (xˉ,yˉ)\centre{(\bar{x}, \bar{y})} and pulls rr toward a negative value
3

Calculate the correlation rr step by step for the following n=5n = 5 data points: (2,16)\data{(2, 16)}, (4,8)\data{(4, 8)}, (6,12)\data{(6, 12)}, (6,8)\data{(6, 8)}, and (7,6)\data{(7, 6)}.

After finding (xˉ,yˉ)\centre{(\bar{x}, \bar{y})} and (sx,sy)\step{(s_x, s_y)}, check the sign of each point's zxzy\step{z_x z_y} product before adding the five products.

Find the means:
xˉ=2+4+6+6+75=255=5,yˉ=16+8+12+8+65=505=10\displaystyle \begin{aligned} \centre{\bar{x}} &= \frac{\data{2} + \data{4} + \data{6} + \data{6} + \data{7}}{5} = \frac{25}{5} = \centre{5}, \\ \centre{\bar{y}} &= \frac{\data{16} + \data{8} + \data{12} + \data{8} + \data{6}}{5} = \frac{50}{5} = \centre{10} \end{aligned}
From the x\data{x}-deviations (−3,−1,+1,+1,+2)(\step{-3}, \step{-1}, \step{+1}, \step{+1}, \step{+2}) and y\data{y}-deviations (+6,−2,+2,−2,−4)(\step{+6}, \step{-2}, \step{+2}, \step{-2}, \step{-4}), find the sample standard deviations:
sx=165−1=4=2,sy=645−1=16=4\displaystyle \begin{aligned} \step{s_x} &= \sqrt{\frac{16}{5 - 1}} = \sqrt{4} = \step{2}, \\ \step{s_y} &= \sqrt{\frac{64}{5 - 1}} = \sqrt{16} = \step{4} \end{aligned}
Find (zx,zy)\step{(z_x, z_y)} and the product zxzy\step{z_x z_y} for each point:
(2,16):zxzy=(−1.5)(+1.5)=−2.25(4,8):zxzy=(−0.5)(−0.5)=+0.25(6,12):zxzy=(+0.5)(+0.5)=+0.25(6,8):zxzy=(+0.5)(−0.5)=−0.25(7,6):zxzy=(+1.0)(−1.0)=−1.00\displaystyle \begin{aligned} \data{(2, 16)}: \quad \step{z_x z_y} &= (\step{-1.5})(\step{+1.5}) = \negative{-2.25} \\ \data{(4, 8)}: \quad \step{z_x z_y} &= (\step{-0.5})(\step{-0.5}) = \positive{+0.25} \\ \data{(6, 12)}: \quad \step{z_x z_y} &= (\step{+0.5})(\step{+0.5}) = \positive{+0.25} \\ \data{(6, 8)}: \quad \step{z_x z_y} &= (\step{+0.5})(\step{-0.5}) = \negative{-0.25} \\ \data{(7, 6)}: \quad \step{z_x z_y} &= (\step{+1.0})(\step{-1.0}) = \negative{-1.00} \end{aligned}
Add the products and divide by n−1=4n - 1 = 4 (watch out: dividing the sum −3.00-3.00 by n=5n = 5 instead of n−1=4n - 1 = 4 is a common mistake and gives the wrong answer r=−0.60r = -0.60):
r\displaystyle r =−2.25+0.25+0.25−0.25−1.005−1\displaystyle = \frac{\negative{-2.25} + \positive{0.25} + \positive{0.25} - \negative{0.25} - \negative{1.00}}{5 - 1} =−3.004\displaystyle = \frac{-3.00}{4} =−0.75\displaystyle = \negative{-}0.75
4

Across 30 cities, the correlation between winter coat sales per person (x\data{x}) and flu cases per 1,000 residents (y\data{y}) is r=+0.82r = \positive{+}0.82. Interpret what r=+0.82r = \positive{+}0.82 means in context, and explain why a store owner is wrong to conclude that buying winter coats causes the flu.

Use the sign and size of +0.82\positive{+}0.82 to describe how the two city measurements move together, then ask what third factor changes during the winter.

(Watch out: don't interpret r=+0.82r = \positive{+}0.82 as an "82%82\% chance of getting the flu from buying a coat." rr is an average of z-score products, not a probability or percentage.) An rr of +0.82\positive{+}0.82 indicates a strong, positive, linear association between winter coat sales and flu cases: cities with higher winter coat sales per person tended to have more flu cases per 1,000 residents. However, correlation only measures how closely two variables move together, not why; cold winter weather is a lurking variable that separately increases both coat sales and flu cases.
5

A biologist finds a correlation of r=−0.68r = \negative{-}0.68 between the altitude in meters where a mountain tree grows (x\data{x}) and the tree's height in meters (y\data{y}). How does rr change if: (a) both measurements are converted from meters to feet; (b) tree height is plotted on the horizontal axis and altitude on the vertical axis; (c) the biologist tries to find the correlation between altitude and the tree's species name?

Check what happens to each tree's zx\step{z_x} and zy\step{z_y} values under each change, and whether zy\step{z_y} can be calculated at all.

(a)Converting meters to feet scales the mean and standard deviation by the same number, leaving every z-score unchanged (don't multiply −0.68\negative{-}0.68 by 3.283.28 to get −2.23-2.23, which would go past −1\negative{-}1), so r=−0.68r = \negative{-}0.68.
(b)Swapping the axes only changes zxzy\step{z_x z_y} to zyzx\step{z_y z_x} for every point (a downhill cloud still slopes downhill when the axes switch places, so don't flip the sign to +0.68+0.68), leaving r=−0.68r = \negative{-}0.68.
(c)Species name is a categorical variable while rr requires both variables to be quantitative, so correlation cannot be calculated.
6

Decide whether each claim is right or wrong and explain why: (a) "Dataset A and Dataset B both have r=+1.0r = \positive{+}1.0, so the line of dots in Dataset A must be just as steep as the line in Dataset B." (b) "The correlation between the price a theater charges per ticket and total ticket revenue is r=0r = 0, which proves ticket price and revenue are unrelated."

For (a), think about what dividing by sy\step{s_y} does to the vertical scale; for (b), picture what happens to total revenue as ticket price goes from $0\$0 to an ideal price to $1,000\$1{,}000.

(a) WrongDon't confuse r=+1.0r = \positive{+}1.0 with a slope of +1+1. Converting to z-scores puts both axes into standard deviations, so a very flat uphill line and a very steep uphill line both have r=+1.0r = \positive{+}1.0 as long as all points lie right on the line.
(b) WrongDon't treat r=0r = 0 as "no relationship of any kind." r=0r = 0 only means there is no straight-line relationship; ticket price and revenue can follow a strong curved relationship (rising to a peak at an ideal price, then falling when tickets become too expensive) where the positive total of the products on the left and the negative total on the right cancel to 00.
7

In a dataset of n=11n = 11 points, ten points form a random cluster right around the center so the sum of their ten zxzy\step{z_x z_y} products is 0.000.00, while the eleventh point is an extreme outlier at zx=+2.0,zy=+2.0\step{z_x} = \step{+2.0}, \step{z_y} = \step{+2.0}. What is rr for all 11 points, what would rr become if that single outlier were at zx=−2.0,zy=+2.0\step{z_x} = \step{-2.0}, \step{z_y} = \step{+2.0} instead (with the other ten products still adding to 0.000.00), and what property of correlation does this show?

Add the eleventh point's zxzy\step{z_x z_y} product to the sum of the first ten (0.000.00), then divide by n−1n - 1 for the full dataset of 1111 points.

At (zx=+2.0,zy=+2.0)(\step{z_x} = \step{+2.0}, \step{z_y} = \step{+2.0}), the eleventh point has product (+2.0)(+2.0)=+4.00(\step{+2.0})(\step{+2.0}) = \positive{+4.00}, making the total sum 0.00+4.00=+4.000.00 + \positive{4.00} = +4.00. Divide by n−1=11−1=10n - 1 = 11 - 1 = 10 (watch out: dividing by n=11n = 11 gives the wrong answer +0.36+0.36, and dividing by 10−1=910 - 1 = 9 from counting only the cluster points gives +0.44+0.44):
r\displaystyle r =+4.0011−1\displaystyle = \frac{+4.00}{11 - 1} =+4.0010\displaystyle = \frac{+4.00}{10} =+0.40\displaystyle = \positive{+}0.40
If the outlier is at (zx=−2.0,zy=+2.0)(\step{z_x} = \step{-2.0}, \step{z_y} = \step{+2.0}) instead, its product is (−2.0)(+2.0)=−4.00(\step{-2.0})(\step{+2.0}) = \negative{-4.00}, changing the correlation to:
r\displaystyle r =−4.0011−1\displaystyle = \frac{-4.00}{11 - 1} =−4.0010\displaystyle = \frac{-4.00}{10} =−0.40\displaystyle = \negative{-}0.40
r=+0.40r = \positive{+}0.40 in the first case and r=−0.40r = \negative{-}0.40 in the second case, which shows that correlation is not resistant to outliers