Linear correlation and Pearson's r coefficient
Correlation measures how much a cloud of points looks like a straight line. Pearson's coefficient sums up that resemblance in a single number between and : the sign tells whether the relationship goes up or down, and the size tells how strong it is. In the IB exam you almost always get it from the calculator, and what earns the marks is describing it with the right words and not drawing conclusions that go too far.
What it means to correlate two variables
In the previous section you plotted pairs of data on a scatter diagram. There is correlation when knowing the value of one variable gives you clues about the other, that is, when the points follow some trend. If that trend looks like a straight line, we speak of linear correlation; if the cloud curves (for example, it rises quickly at first and then levels off), the relationship may be strong but not linear, and the coefficient we are about to meet is not the right tool.
Two features describe a linear correlation:
- The direction (the sign): positive if tends to increase when increases; negative if tends to decrease; zero if no trend can be seen.
- The strength: the closer the points are to a straight line, the stronger the correlation; the more scattered the cloud, the weaker.
An extreme case is the exact relationship: all the points lie on the same straight line. Then the correlation is perfect.
Covariance
To turn the intuition from the picture into a number, we start from how much the two variables move together relative to their means and .
Think about the sign of each term. A point above and to the right of the mean point , or below and to the left, contributes a positive product. A point above and to the left, or below and to the right, contributes a negative one. If the first kind predominate, (an increasing trend); if the second kind predominate, ; if they cancel out, is close to .
The problem with covariance is that it depends on the units: measuring one of the variables in centimetres instead of metres multiplies by 100 even though the relationship has not changed. That is why it is divided by the standard deviations.
Pearson's correlation coefficient
As and are positive, has the same sign as the covariance. And the quotient does not change if you change units or shift the data (adding a constant to them), so allows you to compare relationships between magnitudes of any kind.
To put a name to the strength, a rough scale is used, and it is worth knowing it by heart:
| Value of | Strength of the correlation |
|---|---|
| very weak (almost zero) | |
| weak | |
| moderate | |
| strong |
The cut-offs are not sacred: and describe almost the same thing. What you should do in an answer is combine direction and strength: "strong positive correlation", "weak negative correlation". And, if the question asks for it, do so in context: "the more hours of training, the shorter the race time tends to be, with a strong relationship".
Correlation does not imply causation
That two variables are strongly correlated means that they vary together, not that one produces the other. There are three possible explanations when is large:
- influences (direct cause);
- influences (or they influence each other);
- a third variable influences both, or the coincidence is pure chance.
A classic example: in summer, ice cream sales and cases of sunburn rise together. Their correlation is positive and strong, but eating ice cream does not burn the skin: both depend on the temperature and the hours of sunshine. In the exam, the correct wording is "there is a correlation…", never " causes " based on alone.
Worked examples
Describing correlations from r
Five pairs of variables have been studied and, for each pair, the Pearson correlation coefficient has been obtained. Describe each correlation with the usual words (direction and strength). If the value cannot be a correlation coefficient, say so.
a)
b)
c)
d)
e)
Solution
The scale used is: very weak up to , weak up to , moderate up to and strong above that. The sign gives the direction.
a) and the sign is negative: strong negative correlation.
b) lies between and and is positive: weak positive correlation.
c) lies between and and is positive: moderate positive correlation.
d) : very weak negative correlation; there is practically no linear relationship.
e) , and is always between and : impossible, there is a calculation error.
Answer: a) strong negative; b) weak positive; c) moderate positive; d) very weak negative; e) impossible.
Heat and ice cream sales
An ice cream seller records, over eight days, the maximum temperature, (in C), and the number of ice creams sold, :
| 14 | 17 | 19 | 22 | 25 | 27 | 30 | 33 | |
|---|---|---|---|---|---|---|---|---|
| 38 | 45 | 41 | 58 | 62 | 60 | 77 | 79 |
a) Using the calculator, find the correlation coefficient (3 decimal places).
b) Describe the correlation.
c) Find the covariance (3 significant figures) and check that its sign matches that of .
d) The seller concludes: "when it is hot, people buy more ice cream because it is hot". Can this cause be deduced from ? Justify your answer.
Solution
a) Enter the two lists in the GDC and request linear regression. The result is
b) and it is positive: strong positive correlation. In context: the hotter days tend to sell more ice creams, and the points lie very close to a rising line.
c) Means: and . The products sum to
and then
It is positive, the same as .
d) No. A high value of only says that both variables rise together. Here the explanation is reasonable (heat invites buying ice cream), but the correlation alone does not prove it: other causes would have to be ruled out. The correct thing to say is that there is a strong positive correlation between temperature and sales.
Answer: a) ; b) strong positive; c) ; d) causation cannot be deduced.
r from summary statistics and a change of units
In a study, the number of hours per week that a group of students spend on their phone, , is related to their hours of sleep per night, . It is known that , and .
a) Find and describe the correlation.
b) A new variable is defined. Find the covariance and the correlation coefficient between and . (Hint: .)
c) For these same standard deviations, and , find the maximum possible value of .
Solution
a) Apply the definition:
Since and it is negative, the correlation is strong negative.
b) Each value of is , and its mean is . Then , and substituting into the covariance:
The standard deviation of is (the does not affect it). Therefore
The strength does not change. The sign does, because decreases when increases (multiplying by a negative number reverses the direction).
c) As , it follows that . The maximum is , reached only when the points lie exactly on a line ().
In the exam: give the value of and, separately, a sentence with the direction and strength in the context of the problem ("the more time on the phone, the fewer hours of sleep, with a strong relationship"). If you write it without interpreting, you lose the conclusion mark; and if you say that the phone "causes" people to sleep less, the answer is wrong with only these data.
Common mistakes
Summary
- Positive correlation (the cloud rises), negative (it falls) or zero (no trend); it is strong when the points lie close to a line and weak when they are scattered.
- Covariance: . Its sign gives the direction of the relationship, but it depends on the units.
- Pearson's coefficient: , with and no units; only if all the points lie on a line.
- Rough scale of : up to very weak, up to weak, up to moderate and above strong. Always describe it with the direction: "strong positive", "weak negative"…
- only measures linear relationship and is sensitive to outliers: always look at the scatter diagram.
- Correlation does not imply causation: do not claim that causes just because is large.
- In Paper 2, comes from the GDC's linear regression; in Paper 1, apply the formula to the summarised data.
Want to work on it together?
Free first consultation: we look at your level and your exam, and build a plan. Álvaro replies on WhatsApp.
Message us on WhatsApp