StatisticsExploring Two-Variable Data6 of 8
Exploring Two-Variable Data · 6

Correlation and Causation

Even when two variables have a correlation rr close to 11 and a tight least-squares line, we need to know whether changing XX will actually change YY.

Why Correlation Does Not Mean Causation
Reading Test Score\text{Reading Test Score}
2626
2828
3030
3232
3434
3636
3838
4040
00
2020
4040
6060
8080
100100
Shoe Size (EU)\text{Shoe Size (EU)}

The correlation rr, r2\share{r^2}, and the least-squares regression line only measure whether XX and YY move together on a scatterplot. Because the math cannot tell what causes what, an upward slope can happen in four different ways:

Direct cause\text{Direct cause}
XX
YY
Reverse cause\text{Reverse cause}
XX
YY
Common cause\text{Common cause}
XX
YY
Z\htmlClass{lc-orange}{Z}
Plain coincidence\text{Plain coincidence}
XX
YY
Direct cause:X⟶Y(practicing piano ⟶ recital score)Reverse cause:Y⟶X(days with a fever ⟶ fever medicine taken)Common cause:X⟵Z⏟lurking(confounding)variable⟶Y(fire size drives firefighterssent and dollar damage)Plain coincidence:XY(no arrows: two unrelatedtrends match by luck)\displaystyle \begin{aligned} &\text{Direct cause:} \\ &\quad X \longrightarrow Y \\ &\quad \text{(practicing piano } \longrightarrow \\ &\qquad \text{ recital score)} \\[12pt] &\text{Reverse cause:} \\ &\quad Y \longrightarrow X \\ &\quad \text{(days with a fever } \longrightarrow \\ &\qquad \text{ fever medicine taken)} \\[12pt] &\text{Common cause:} \\ &\quad X \lurk{\longleftarrow} \lurk{\underbrace{Z}_{\substack{\text{lurking} \\ \text{(confounding)} \\ \text{variable}}}} \lurk{\longrightarrow} Y \\ &\quad \text{(}\lurk{\text{fire size}}\text{ drives firefighters} \\ &\qquad \text{sent and dollar damage)} \\[12pt] &\text{Plain coincidence:} \\ &\quad X \qquad\quad Y \\ &\quad \text{(no arrows: two unrelated} \\ &\qquad \text{trends match by luck)} \end{aligned}

In the elementary school dataset, shoe size (XX) and reading test score (YY) have r≈1r \approx 1, but buying bigger shoes will not help a child read:

Text solution:

1

Testing for Lurking Variables by Slicing

When a lurking variable isn't obvious from common sense, we need a way to test the data itself to see whether a third factor Z\lurk{Z} is creating the slope between XX and YY.

Testing for Lurking Variables by Slicing
bottled water(X)\begin{gathered}\text{bottled water}\\[-4pt] \text{(X)}\end{gathered}
+5 years\text{+5 years}
lifespan(Y)\begin{gathered}\text{lifespan}\\[-4pt] \text{(Y)}\end{gathered}
?\text{?}
household income (Z)\htmlClass{lc-orange}{\text{household income (Z)}}
betterhealthcare\begin{aligned}&\text{better}\\[-4pt] &\text{healthcare}\end{aligned}

To test whether Z\lurk{Z} is creating a false relationship between XX and YY, we slice the data, holding Z\lurk{Z} fixed so we only compare dots that share the exact same value of Z\lurk{Z}:

Text solution:

Inside any single age group (6\lurk{6}, 8\lurk{8}, or 11\lurk{11}), the least-squares line between shoe size and reading score is flat, while combining those stepped groups creates the steep upward line across the whole school.

Inside every single age group, the trend between shoe size and reading score is completely flat, even though combining all ages creates a steep upward line.

In observational data from the real world, we can only slice by variables we thought to measure, so twenty other unknown lurking variables could still be at work. In an experiment, scientists rule out every lurking variable at once using random assignment:

Coin flip (random assignment)⏟breaks all Z⟶X links⟶{Bottled water groupTap water group\displaystyle \text{Coin flip } \underbrace{(\text{random assignment})}_{\text{breaks all } \lurk{Z} \lurk{\longrightarrow} X \text{ links}} \longrightarrow \begin{cases} \text{Bottled water group} \\ \text{Tap water group} \end{cases}
2

Interpolation and Extrapolation

Even when a relationship is real, like age driving height during childhood, and our least-squares line fits the dots closely with a high r2\share{r^2}, we need to know how far along the XX axis we can trust the line's predictions.

Interpolation and Extrapolation
Predicted Height=30+2.5(Age)\htmlClass{lc-violet}{\text{Predicted Height}} = 30 + 2.5(\text{Age})
Height (inches)\text{Height (inches)}
22
44
66
88
1010
1212
1414
1616
00
2020
4040
6060
8080
Age (years)\text{Age (years)}

Using data measured on children from Age 2\text{Age } \data{2} to Age 16\text{Age } \data{16}, the least-squares regression line is:

Predicted Height\displaystyle \fitted{\text{Predicted Height}} =30+2.5(Age)\displaystyle = 30 + 2.5(\text{Age})

Whether a prediction from this line makes sense depends on where the chosen age sits compared to the ages we actually measured:

Text solution:

Between ages 2\data{2} and 16\data{16}, the straight least-squares line follows the measured childhood data closely, but beyond age 1616 the extended line keeps climbing past 1212 feet while actual human height levels off into adulthood.

A straight line fits how kids grow from age 2 to 16, but extending it into adulthood assumes people never stop growing.

A straight trend can also hit a point where the rules suddenly change. If you heat a pot of 20∘C\data{20}^\circ\text{C} liquid water across Minutes 11, 22, and 33 (30∘C\data{30}^\circ\text{C}, 40∘C\data{40}^\circ\text{C}, 50∘C\data{50}^\circ\text{C}), extending the line to Minute 2020 misses the boiling point where liquid water turns to steam and stays at 100∘C100^\circ\text{C}:

Minutes 1 to 3:Predicted Temperature=20+10(Minutes)⟶At Minute 20:20+10(20)=220∘C⏟fails: liquid water caps at 100∘C\displaystyle \begin{aligned} &\text{Minutes } \data{1} \text{ to } \data{3}: \\ &\quad \fitted{\fitted{\text{Predicted Temperature}}} \\ &\qquad = 20 + 10(\text{Minutes}) \\[12pt] &\longrightarrow\quad \text{At Minute } 20: \\ &\quad \underbrace{20 + 10(20) = \fitted{220}^\circ\text{C}}_{\text{fails: liquid water caps at } 100^\circ\text{C}} \end{aligned}

Even if a trend didn't bend or hit a boundary, our regression slope is only an estimate from a sample with scatter. Because of that sample scatter, a tiny tilt of the line barely shifts predictions inside the Age 2\data{2} to 16\data{16} cloud, but swings the line up and down by feet at Age 5050 as the uncertainty spreads out wider and wider.

Lines that all fit the sample dots closely stay close together inside the range of the data, but spread out by feet far outside it.

Because uncertainty widens the farther we step from the measured XX values, predicting one small step outside the range (like Age 17\text{Age } 17 after measuring up to Age 16\text{Age } \data{16}) carries only a small risk, while predicting 3434 steps out (Age 50\text{Age } 50) is a wild guess.

Key concepts

Whenever a scatterplot shows a strong correlation rr and a tight least-squares line, run two checks before trusting a conclusion or prediction:

1. The lurking variable check (why do XX and YY move together?)

Because rr only checks whether XX and YY move together, identify which arrow pattern fits the situation: direct cause (X⟶YX \longrightarrow Y, hours of piano practice ⟶\longrightarrow recital score), reverse cause (Y⟶XY \longrightarrow X, days with a fever ⟶\longrightarrow fever medicine taken), common cause / lurking variable (X⟵Z⟶YX \lurk{\longleftarrow} \lurk{Z} \lurk{\longrightarrow} Y, Age\lurk{\text{Age}} driving both Shoe Size\text{Shoe Size} and Reading Score\text{Reading Score}), or plain coincidence (no arrows, cheese consumption and bedsheet deaths).

  • When to slice: To test whether a suspected lurking variable Z\lurk{Z} is driving the relationship, hold Z\lurk{Z} fixed in a single slice (only 8\lurk{8}-year-olds, or only Household Income=$50,000\lurk{\text{Household Income}} = \lurk{\$50{,}000}). If the slope between XX and YY flattens out inside the slice, XX does not cause YY.
  • When slicing is not enough: Even if a slope remains after slicing by one variable Z\lurk{Z} in observational data, unmeasured lurking variables can still be hiding. To block every lurking variable at once, use an experiment with random assignment (flipping a coin to assign XX).
2. The extrapolation check (where is the target XX compared to the measured data?)

Compare the XX value you want to plug into Predicted Y=a+bX\fitted{\text{Predicted } Y} = a + bX against the observed range of data (smallest X≤X≤largest X\data{\text{smallest } X} \le X \le \data{\text{largest } X}, such as Age 2 to Age 16\text{Age } \data{2} \text{ to Age } \data{16} for Predicted Height=30+2.5(Age)\fitted{\text{Predicted Height}} = 30 + 2.5(\text{Age})):

  • Interpolation (Age 10\text{Age } 10, inside Age 2 to 16\text{Age } \data{2} \text{ to } \data{16}): Trustworthy, because the prediction is surrounded by measured data on both sides.
  • Near extrapolation (Age 17\text{Age } 17, one small step outside Age 2 to 16\text{Age } \data{2} \text{ to } \data{16}): Fairly small uncertainty, because the uncertainty has barely widened just past the data.
  • Far extrapolation (Age 50\text{Age } 50, far outside Age 2 to 16\text{Age } \data{2} \text{ to } \data{16}): Untrustworthy, because outside the measured window a curve can level off (people stop growing after childhood), the rules can change at a boundary (liquid water boils and stays at 100∘C100^\circ\text{C}), and a tiny error in the sample slope swings the line wide like the far tip of a long ruler.
3

Practice

1

For each pair of correlated variables below, state which of the four explanations best fits (Direct Cause, Reverse Cause, Common Cause / Lurking Variable, or Plain Coincidence) and give the direction of any causal arrows: (a) Across patients at a clinic, the number of physical therapy visits attended in a year (XX) and the initial severity of the patient's joint injury (YY). (b) Across summer days in a beach town, daily sunglass sales (XX) and daily sunburn clinic visits (YY). (c) Over a 5-year span, annual U.S. per-capita cheese consumption (XX) and annual deaths from getting tangled in bedsheets (YY). (d) Across piano students, hours spent practicing for a recital (XX) and recital score (YY).

For each pair, ask: "If I forced XX to go up, would YY change? Or did YY happen first, did a third factor Z\lurk{Z} push both, or is there no real-world connection between them at all?"

(a)Watch out: Don't pick Direct Cause (X⟶YX \longrightarrow Y) just because XX is listed first. Attending physical therapy later in the year cannot go back in time to make the initial injury worse. Instead, a more severe initial injury (YY) causes a patient to attend more physical therapy visits (XX):
Reverse Cause (Y⟶X)\displaystyle \text{Reverse Cause } (Y \longrightarrow X)
(b)Buying sunglasses does not cause sunburns, and sunburns do not make people buy sunglasses that same day; instead, hot, sunny weather (Z\lurk{Z}) drives both higher sunglass sales (XX) and more sunburns (YY), with no arrow between XX and YY:
Common Cause / Lurking Variable (Z⟶X and Z⟶Y)\displaystyle \text{Common Cause / Lurking Variable } (\lurk{Z} \lurk{\longrightarrow} X \text{ and } \lurk{Z} \lurk{\longrightarrow} Y)
(c)Two unrelated national trends happened to move in the same direction over a short 55-year window by pure luck:
Plain Coincidence (no arrows)\displaystyle \text{Plain Coincidence (no arrows)}
(d)Practicing more hours (XX) directly builds skill and raises the recital score (YY):
Direct Cause (X⟶Y)\displaystyle \text{Direct Cause } (X \longrightarrow Y)
2

A study of 500 employees at a large company finds a strong positive correlation (r=0.84r = 0.84) between the number of computer monitors on an employee's desk (XX) and their annual salary (YY). An office supply store claims: "Give yourself a raise: put a third monitor on your desk!" (a) Name a plausible lurking variable Z\lurk{Z} and explain how it drives both XX and YY. (b) When you slice the data to hold job seniority level fixed, looking separately at entry-level staff, mid-level specialists, and senior executives, the least-squares line between monitors and salary inside each slice is completely flat. What does this tell you about the store's claim and why the overall scatterplot sloped upward?

(a) Think of a workplace factor Z\lurk{Z} that determines both an employee's equipment needs (XX) and their pay (YY). (b) Check what a slope of 0\fitted{0} inside each fixed-Z\lurk{Z} slice tells you when XX increases while Z\lurk{Z} stays the same.

(a)Job seniority or role (Z\lurk{Z}): Higher-ranking roles require more monitors for complex work (Z⟶X\lurk{Z} \lurk{\longrightarrow} X) and also pay higher salaries (Z⟶Y\lurk{Z} \lurk{\longrightarrow} Y).
(b)Watch out: Don't be fooled by the high overall correlation (r=0.84r = 0.84) into thinking extra monitors still help a little, and don't misread the flat slices as saying seniority doesn't affect pay. Because the slope between monitors and salary drops to 0\fitted{0} when seniority is held fixed, adding a monitor does not raise salary at all; the store's claim is false, and the upward slope in the combined data only happened because we combined separate seniority groups that shift toward more monitors and higher pay as seniority rises.
3

An observational study finds that people who drink expensive bottled water (XX) live longer on average (YY) than people who drink tap water. Even after researchers slice the data to hold Household Income fixed at $50,000\lurk{\$50{,}000} per year, bottled-water drinkers in that slice still live slightly longer. (a) Why can we still not be sure from this observational data that bottled water causes longer life? (b) How can scientists design an experiment to rule out all lurking variables at once?

(a) Ask whether two people earning $50,000\lurk{\$50{,}000} who choose different water might still differ in other lifestyle habits Z\lurk{Z}. (b) How can researchers assign who drinks which water so personal habits cannot influence the choice?

(a)Watch out: Keeping a slope in one slice does not prove causation (X⟶YX \longrightarrow Y). Slicing by Household Income only holds income fixed; in observational data, many other unmeasured lurking variables (such as exercise habits, diet, health habits, or local tap-water quality) were not held fixed and could still be driving both bottled-water purchases and how long people live inside the $50,000\lurk{\$50{,}000} slice.
(b)Watch out: Simply slicing by a few more variables still leaves unknown lurking variables untouched. Instead, scientists use random assignment, such as flipping a coin to decide who drinks bottled water and who drinks tap water, which breaks the link between water type and every lurking variable at once.
4

A veterinarian measures the weight of puppies (YY, in pounds) from Age X=2X = \data{2} weeks to Age X=16X = \data{16} weeks and finds a strong linear relationship (r2=0.96\share{r^2} = \share{0.96}) with least-squares line Predicted Weight=2+1.5(Age in weeks)\fitted{\text{Predicted Weight}} = 2 + 1.5(\text{Age in weeks}). Find the predicted weight at (a) Age 1010 weeks, (b) Age 1717 weeks, and (c) Age 150150 weeks (about 33 years old). For each, state whether it is interpolation or extrapolation and how trustworthy the prediction is.

Compare each target age against the measured range of 2\data{2} to 16\data{16} weeks: is it inside the data range, a single week past the edge, or years outside the range?

(a)At Age 1010 weeks (watch out: multiply 1.5×101.5 \times 10 before adding 22; adding first to get 3.5×10=35 lb3.5 \times 10 = 35\text{ lb} is an order-of-operations mistake):
Predicted Weight\displaystyle \fitted{\text{Predicted Weight}} =2+1.5(10)\displaystyle = 2 + 1.5(10) =17 pounds\displaystyle = \fitted{17}\text{ pounds}
Because 1010 weeks is inside the measured range of 2\data{2} to 16\data{16} weeks, this is interpolation and is trustworthy (backed by data on both sides).
(b)At Age 1717 weeks:
Predicted Weight\displaystyle \fitted{\text{Predicted Weight}} =2+1.5(17)\displaystyle = 2 + 1.5(17) =27.5 pounds\displaystyle = \fitted{27.5}\text{ pounds}
Watch out: Don't call this completely useless just because it steps outside 2\data{2} to 16\data{16} weeks. This is extrapolation, but because 1717 weeks is only one small step beyond the measured range of 16\data{16} weeks, the prediction uncertainty is still fairly small.
(c)At Age 150150 weeks:
Predicted Weight\displaystyle \fitted{\text{Predicted Weight}} =2+1.5(150)\displaystyle = 2 + 1.5(150) =227 pounds\displaystyle = \fitted{227}\text{ pounds}
Watch out: Don't trust this prediction just because r2=0.96\share{r^2} = \share{0.96} is high. This is far extrapolation (134134 weeks outside the measured data) and is completely untrustworthy because dogs stop growing and level off in weight long before 150150 weeks.
5

In each case below, a regression line with high r2\share{r^2} and small residuals fails when extrapolated. Explain the specific reason why extrapolation breaks down in each situation: (a) A chef heats a pot of liquid water on a stove, records its temperature at Minute 11 (30∘C\data{30}^\circ\text{C}), Minute 22 (40∘C\data{40}^\circ\text{C}), and Minute 33 (50∘C\data{50}^\circ\text{C}), fits the exact line Predicted Temperature=20+10(Minutes)\fitted{\text{Predicted Temperature}} = 20 + 10(\text{Minutes}), and predicts the liquid water in the pot will reach 220∘C\fitted{220}^\circ\text{C} at Minute 2020. (b) Two researchers each collect a sample of children aged 2\data{2} to 16\data{16} and fit a least-squares line predicting height from age. Because of random scatter in their samples, their estimated slopes differ by 0.1\spread{0.1} inches per year. At Age 1010, their lines predict nearly the same height, so they assume their lines will also agree closely if extended to Age 6060.

(a) What happens to liquid water at 100∘C100^\circ\text{C} that the 30∘C\data{30}^\circ\text{C}-to-50∘C\data{50}^\circ\text{C} data could not show? (b) Picture a long ruler laid through the Age 2\data{2} to 16\data{16} data cloud: what does a 0.1 in/yr\spread{0.1}\text{ in/yr} tilt do 5050 years further down the ruler?

(a)Watch out: The problem here is not sample scatter, since the line fits Minutes 1\data{1} to 3\data{3} with zero error. Extrapolation breaks down because the physical rules change at a boundary outside the measured range: at 100∘C100^\circ\text{C}, liquid water boils into steam and its temperature stays flat at 100∘C100^\circ\text{C}, a boundary the 30∘C\data{30}^\circ\text{C}-to-50∘C\data{50}^\circ\text{C} data had no way of showing.
(b)Watch out: Close agreement inside the data range does not stay close far outside it. Small uncertainty in the sample slope grows with distance from the data: like a tiny tilt in a long ruler, a 0.1 in/yr\spread{0.1}\text{ in/yr} slope difference barely moves the line inside the Age 2\data{2} to 16\data{16} cloud, but over the 5050 years from Age 1010 to Age 6060 it swings the two predictions apart by 0.1×50=5 inches\spread{0.1} \times 50 = \spread{5}\text{ inches} as the uncertainty spreads out.