Lesson 10.4 · Data and Statistics
Correlation and causation
Do students who sleep more get better grades? Do cities with more trees have cooler summers? Questions like these are about the relationship between two numerical variables. In this lesson you'll measure how strong a linear relationship is with a single number, the correlation coefficient, and learn why a strong relationship still doesn't prove that one variable causes the other.
Describing a scatter plot
A scatter plot shows two-variable data as points . The variable on the horizontal axis is often called the explanatory variable and the one on the vertical axis the response variable. When you describe the pattern, discuss three things:
- Direction. In a positive association, tends to increase as increases. In a negative association, tends to decrease as increases.
- Form. Do the points follow a straight line (linear) or a curve (nonlinear)?
- Strength. How tightly do the points cluster around that line or curve?
The points above rise from left to right and hug an imaginary line closely: a strong, positive, linear association.
The correlation coefficient
Words like "strong" and "weak" are a matter of opinion. The correlation coefficient replaces them with a number.
Definition
Correlation coefficient
The correlation coefficient is a number from to that measures the direction and strength of a linear association between two numerical variables.
- The sign of gives the direction: positive or negative.
- The size of (how close it is to or ) gives the strength.
- or means every point lies exactly on a line. means there is no linear association at all.
The correlation coefficient is found with a calculator or spreadsheet. These rough guidelines help you put it into words:
| value of | description |
|---|---|
| strong | |
| moderate | |
| weak | |
| little or no linear association |
The study-hours data above have . The two plots below show a moderate negative association and no association.
Worked example: Interpreting r
For used cars of the same model, the correlation between the number of miles driven and the selling price is . Interpret this value.
The sign is negative, so cars with more miles tend to sell for less. Since is at least , the association is strong. In context: there is a strong, negative, linear association between mileage and price for these cars.
Common mistake
A negative is not a weaker . The number describes a stronger relationship than , because is closer to than is to . The sign only tells you the direction. Compare strengths using .
Where r comes from
You won't need to compute by hand, but you can see why its sign works. Draw a vertical line at the mean and a horizontal line at the mean . They cut the scatter plot into four regions.
- A point up and to the right of the center has and , so the product is positive. A point down and to the left has two negative factors, so its product is also positive.
- Points in the other two regions have one positive and one negative factor, so their products are negative.
The correlation coefficient is built by adding up these products (after rescaling so that the units cancel). When most points sit in the lower-left and upper-right regions, the sum is positive and so is . When most sit in the upper-left and lower-right regions, is negative. When the points are spread evenly among all four, the products cancel and is near .
This explains several useful facts:
- has no units, and it doesn't change if you change units (inches to centimeters, dollars to euros).
- Switching which variable is and which is doesn't change .
- The sign of always matches the sign of the slope of the line of best fit. But is not the slope: a nearly flat line can still have close to if the points hug it tightly.
What r can't tell you
r only measures linear relationships
A correlation near means there is no linear association. It does not mean there is no relationship. Always look at the scatter plot before trusting .
Worked example: A perfect relationship with r = 0
The points , , , , , , lie exactly on the parabola . Their correlation coefficient is exactly . Why?
The left half of the pattern goes down and the right half goes up. The negative trend on the left exactly cancels the positive trend on the right, so there is no overall linear trend. The relationship is perfect, but it's a curve, and can't see curves.
A single outlier can also change dramatically.
Worked example: One point changes everything
These eight points have :
Adding a ninth point, , drops the correlation to .
The eight original points still follow a clear line. One point far from that line is enough to make the association look weak. When you see an outlier, report both with and without it, and try to find out why that point is different.
Correlation is not causation
Even a strong correlation does not show that changes in one variable cause changes in the other.
Definition
Lurking variable
A lurking variable is a variable that is not part of the study but affects both of the variables being studied. It can create a correlation between two variables that have no direct effect on each other.
Worked example: Spot the lurking variable
Across the days of a year, a town finds a strong positive correlation between the number of people at the public pool and the number of air conditioners sold. Does going to the pool make people buy air conditioners?
No. Both variables go up on hot days. Temperature is a lurking variable that drives both. Closing the pool would not reduce air conditioner sales.
A correlation can arise in several ways: might cause ; might cause ; a lurking variable might drive both; or the pattern might be a coincidence, especially in a small data set. To show that one variable actually causes a change in another, researchers run a randomized experiment: they randomly assign subjects to groups, change only the variable being tested, and compare the results. Random assignment balances out lurking variables between the groups.
Tip
When you read a headline like "People who do X live longer," ask two questions. Was this an experiment or just an observation? And what else might be different about the people who do X?
Practice
Which correlation coefficient shows the strongest linear association?
Which value is the best estimate of the correlation coefficient for this scatter plot?
For a group of hikers, the correlation between the altitude they reach and the air temperature they measure there is . Is the association positive or negative?
Type your answer
The correlation between the heights of plants, measured in inches, and their numbers of leaves is . The heights are converted to centimeters ( inch cm). What is the new correlation coefficient?
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
A scatter plot of the height of a thrown ball against time forms a clear upside-down U shape. Its correlation coefficient is . Which conclusion is correct?
In a study of towns, the number of churches is strongly positively correlated with the number of restaurants. Which is the most likely explanation?
A data set of points has . One point lies far below the others. When that point is removed, which new value of is most plausible if the other points lie close to a rising line?
A researcher finds that students who eat breakfast have higher test scores. Which study design would give the strongest evidence that eating breakfast causes higher scores?