Linear correlation and Pearson's correlation coefficient
When two variables are measured on the same individuals, the natural question is whether they are related and how strongly. The scatter diagram gives a first visual impression, and Pearson's product-moment correlation coefficient, , turns it into a number between and . In the IB exam it is almost never calculated by hand: it is obtained with the graphic display calculator (GDC), and what is marked is interpreting it correctly: sign, strength, type of relationship and, above all, not confusing correlation with causation.
Correlation: what it measures and the types
There is correlation between two variables when the values of one are associated with the values of the other. To detect it, the scatter diagram (cloud of points) is drawn with one variable on each axis and the way the points are spread is observed.
It is described with three features:
- Direction. If tends to increase as increases, the correlation is positive. If tends to decrease as increases, it is negative. If the cloud follows no direction, there is no correlation (zero correlation).
- Strength. The narrower and more closely aligned the points are around a line, the stronger the correlation; the more scattered they are, the weaker.
- Form. The correlation is linear when the points cluster around a straight line, and non-linear when they follow a curve (for example, a parabola or a curve that rises ever more slowly).
Everyday examples: hours of study and the mark in an exam usually have a positive correlation; outside temperature and spending on heating, a negative one; a student's shoe size and their maths mark, none.
Pearson's product-moment correlation coefficient
The eye is subjective, so a number is used. Pearson's product-moment correlation coefficient measures how well the cloud fits a straight line.
Dividing by removes the units of measurement. That is why does not change if you convert from metres to centimetres or from euros to dollars, and it can be used to compare relationships between different quantities.
Two points that the exam exploits:
- measures only linear relationships. There can be a very clear relationship with close to if the cloud follows a curve. For example, the points , , , and satisfy exactly, but their is , because the left and right parts of the parabola cancel each other out.
- A value of close to in absolute value, with few points or with one value far from the others, can be misleading. Always look at the scatter diagram as well as at the number.
Correlation and causation
The fact that two variables are correlated does not show that one causes the other. There are three possible explanations for a high correlation:
- influences (direct causal relationship).
- influences (the cause is the reverse).
- There is a third variable that influences both, or it is pure coincidence.
Example: ice cream consumption and the number of people swimming at the beach have a strong positive correlation over the year. Eating ice cream does not make people go swimming; both increase when it is hot, and heat is the hidden variable.
Always write the conclusion cautiously: "there is a strong positive correlation between the variables", and only add "which suggests that…" if the context justifies it.
Worked examples
From covariance to Pearson's coefficient
In a study of the time per day that a group of adults spend walking (, in hours) and their resting pulse (, in beats per minute), the following parameters were obtained: , and covariance .
a) Calculate Pearson's correlation coefficient.
b) Describe the strength and the direction of the correlation.
Solution
a) The definition is applied:
b) The sign is negative, so when the time spent walking increases, the resting pulse tends to decrease. As lies between and , the correlation is strong. It is a strong negative correlation.
Piano practice and score
Eight students at a music school practise each week a number of hours () and obtain a score () in an audition.
| Student | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| Hours of practice, | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| Score, | 3 | 5 | 4 | 8 | 6 | 9 | 7 | 10 |
a) Find Pearson's correlation coefficient using the calculator.
b) Describe the correlation and interpret it in context.
c) State whether, with these data, it can be claimed that practising more hours makes the score higher.
Solution
a) The lists of and are entered into the GDC and the linear regression is requested. The calculator returns
b) , so the correlation is positive; and , so it is strong. In context: students who practise more hours tend to obtain a higher score in the audition, and the relationship is clearly linear.
c) It cannot be claimed with certainty. The coefficient only shows an association. There could be other factors (for example, prior talent or the level of the course) that explain both why some students practise more and why they obtain better scores. With a sample of only 8 students, moreover, the conclusion is even more limited.
Temperature and hot chocolate
A café records for seven days the maximum temperature (, in °C) and the number of hot chocolates it sells ().
| Day | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|
| Temperature, (°C) | 4 | 6 | 7 | 9 | 11 | 12 | 14 |
| Hot chocolates sold, | 22 | 17 | 18 | 13 | 9 | 10 | 4 |
a) Find Pearson's correlation coefficient and interpret its value in context.
b) Another variable gives the seven pairs , , , , , and , which satisfy . Calculate for these data and explain why this does not contradict the existence of a relationship between the variables.
c) A manager claims: "the cold makes people drink more hot chocolate, so lowering the heating in the shop will increase sales". Comment on whether the data in the table allow this conclusion to be drawn.
Solution
a) With the GDC, entering the two lists and requesting the linear regression: As and , the correlation is negative and strong: the colder days tend to sell more hot chocolates, and the milder days fewer. The points lie very close to a descending line.
b) Entering these seven pairs into the GDC gives The reason is that the cloud is symmetric about the -axis: the left branch of the parabola falls (negative relationship) and the right branch rises (positive relationship), and the two effects cancel out in the calculation of the covariance. But only measures linear relationship. Between these variables there is a perfect relationship, , which is not a straight line. A value of close to does not mean "there is no relationship", but "there is no linear relationship". That is why the scatter diagram must always be looked at.
c) The data only show an association between the two variables. The conclusion that the cold causes higher sales is reasonable from the context, but the table does not prove it. Moreover, the proposed measure (lowering the heating in the shop) is not related to the outside temperature, which is the variable recorded: the study says nothing about what would happen if the indoor temperature were changed. It cannot be concluded that this measure would increase sales.
In the exam: when giving , the value (3 significant figures), its sign and its strength are marked, together with a sentence in the context of the problem. If causation is asked about, the correct answer is that correlation does not imply causation, and an alternative explanation or a hidden variable must be named. If is close to , do not write "there is no relationship" without adding "linear".
Common mistakes
Summary
- There is correlation when the values of one variable are associated with those of another. It is described by its direction (positive, negative or zero), its strength (strong, moderate, weak) and its form (linear or not).
- Pearson's coefficient is and satisfies . Its sign is that of the covariance; its absolute value gives the strength.
- Approximate scale of : up to 0.25 very weak; up to 0.5 weak; up to 0.75 moderate; up to 1 strong.
- measures only linear relationship: does not rule out a curved relationship. Always look at the scatter diagram.
- Correlation is not causation: there may be a hidden variable, the reverse relationship or simple coincidence.
- In the exam, calculate with the GDC, write it to 3 significant figures and describe it in context.
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