4.4 · SLPaper 1Paper 2

Correlation and regression (y on x)

In a minute

Pairs of measurements, such as a café's distance from a station and its daily customers, are . You describe how the two move together, measure a straight-line link with Pearson's rr, and predict with the of yy on xx. You also learn when a prediction can't be trusted.

You'll be able to

  • Describe the on a by direction and strength.
  • Draw a by eye through the point.
  • Find Pearson's rr on your GDC, compare it with a , and know it measures straight-line links only.
  • Explain why correlation does not show .
  • Find y=ax+by = ax + b on your GDC, predict with it, and interpret aa and bb.
  • Spot unreliable predictions: , or using the line to predict xx.
Before you start3 quick questions on what this builds on
Check yourself
Find the of the line through (3,10)(3, 10) and (8,25)(8, 25).
Check yourself
For the line y=2.5x−4y = 2.5x - 4, find yy when x=12x = 12.
Check yourself
Find the mean of 1919, 3434, 2828 and 2727.

Revise first: 2.1 Straight-line equations, 2.6 Fitting and testing models and 4.3 Central tendency and dispersion

Scatter diagrams and lines of best fit

Do cafés further from a station get fewer customers? You need two measurements from each café, kept as a pair. Data in pairs is .

Put the variable that might explain the other on the xx-axis, and the one you want to predict on the yy-axis.

Direction: positive if yy tends to rise as xx rises, negative if it tends to fall, zero if there is no trend. Strength: strong if the points lie close to a line, weak if loosely spread, none if there is no pattern.

Six small scatter diagrams. Strong positive: points rise in a narrow band. Weak positive: points rise but are widely spread. No correlation: points scattered with no trend. Weak negative: points fall but are widely spread. Strong negative: points fall in a narrow band. Curved: points rise and then fall along a smooth curve. Strong positive Weak positive No correlation Weak negative Strong negative Curved, not linear
The last panel has a clear pattern, but not a straight-line one.
Worked exampleEight cafés record their distance xx km from a train station and their mean number of customers yy per day. xx: 0.2,0.5,0.9,1.3,1.8,2.4,3.0,3.60.2, 0.5, 0.9, 1.3, 1.8, 2.4, 3.0, 3.6. yy: 310,284,262,221,205,168,150,119310, 284, 262, 221, 205, 168, 150, 119. Draw a scatter diagram and describe the correlation in context.

Try it first, then reveal one step at a time.

  1. Distance goes on the xx-axis. Plot the eight points (diagram below).
Scatter diagram of customers per day against distance from the station in kilometres for eight cafes. The points fall from about 310 customers at 0.2 km to about 120 customers at 3.6 km, lying close to a straight line. 0 1 2 3 4 0 50 100 150 200 250 300 350 distance from station x (km) customers per day y
Check yourself
Teenagers with more screen time tend to sleep fewer hours, but the points are widely spread. Describe the correlation.

A straight line through the middle of the points sums up a strong trend.

Plot the mean point, then rule a line through it with about as many points above as below. For its equation, read a second point off the line and use these booklet formulas from 2.1.

In the formula booklet
m=y2−y1x2−x1m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}
In the formula booklet
y=mx+c;ax+by+d=0;y−y1=m(x−x1)y = mx + c; \quad ax + by + d = 0; \quad y - y_{1} = m(x - x_{1})
Worked exampleA courier records the number of parcels xx and the time yy minutes for six delivery rounds. xx: 36,42,47,53,58,6436, 42, 47, 53, 58, 64. yy: 71,80,89,97,106,11571, 80, 89, 97, 106, 115. (a) Find the mean point. (b) A line of best fit drawn by eye through the mean point also passes through (40,77)(40, 77). Find its equation. (c) Interpret its gradient.

Try it first, then reveal one step at a time.

  1. (a) xˉ=3006=50\bar{x} = \frac{300}{6} = 50 and yˉ=5586=93\bar{y} = \frac{558}{6} = 93, so the mean point is (50,93)(50, 93).
Scatter diagram of delivery time in minutes against number of parcels for six rounds. The mean point at 50 parcels and 93 minutes is circled. A straight line of best fit passes through the mean point and through the point 40 parcels, 77 minutes, with the data points close to it on both sides. 30 40 50 60 70 60 70 80 90 100 110 120 number of parcels x time y (minutes) mean point (50, 93) (40, 77)
The line passes through the mean point (50,93)(50, 93).

Pearson's correlation coefficient

Strong and weak are judgements. Pearson's rr turns the correlation into one number.

Learn this
−1≤r≤1-1 \le r \le 1

The sign gives the direction. r=±1r = \pm 1 means every point lies on a straight line, r=0r = 0 means no linear correlation, and the closer ∣r∣\lvert r\rvert is to 11, the stronger the correlation. If a question gives a table of strengths, use it.

Your GDC gives rr with the regression line. Exams expect the GDC value, not a hand calculation.

Worked exampleUse your GDC to find Pearson's rr for the café data (xx: distance in km, yy: customers per day). Interpret the value.

Try it first, then reveal one step at a time.

  1. Enter distances in the first list and customers in the second. Run linear regression: r=−0.98996…≈−0.990r = -0.98996\ldots \approx -0.990.
Check yourself
A data set has r=−0.93r = -0.93. Which statement is correct?

With few points, a fairly large ∣r∣\lvert r\rvert can happen by chance. A , given in the question, says how large ∣r∣\lvert r\rvert must be for that number of pairs.

Worked exampleFor 1313 lakes, water temperature and dissolved oxygen have r=−0.61r = -0.61. The critical value for 1313 pairs is 0.5530.553. Determine whether there is significant linear correlation, and interpret the result.

Try it first, then reveal one step at a time.

  1. Compare the size of rr with the critical value: ∣r∣=0.61>0.553\lvert r\rvert = 0.61 > 0.553, so it is significant.
Check yourself
For 1616 pairs, r=0.43r = 0.43 and the critical value is 0.4970.497. What can you conclude?

rr only measures closeness to a straight line. Data on a clear curve can still have rr near 00, so look at the scatter diagram too.

Worked exampleA car's fuel use yy, in litres per 100100 km, is measured at speeds xx km/h. xx: 40,60,80,100,12040, 60, 80, 100, 120. yy: 8.2,6.1,5.4,6.1,8.28.2, 6.1, 5.4, 6.1, 8.2. (a) Use your GDC to find rr. (b) A student says speed and fuel use are not related. Comment.

Try it first, then reveal one step at a time.

  1. (a) Linear regression gives r=0r = 0.
Scatter diagram of fuel use in litres per 100 kilometres against speed in kilometres per hour. The five points form a U shape: 8.2 at 40, 6.1 at 60, a lowest value of 5.4 at 80, then 6.1 at 100 and 8.2 at 120. A dashed curve joins them. 40 60 80 100 120 4 5 6 7 8 9 speed x (km/h) fuel use y (litres per 100 km)
A clear pattern, but not a straight line. Here r=0r = 0.

Correlation is not causation

Correlation shows two variables move together. It doesn't show that changing one changes the other.

Often a third variable drives both, or the link is a coincidence. So correlation does not imply causation, however strong.

Worked exampleOver 1616 weeks at a ski resort, the number of hot drinks sold and the number of ski injuries have r=0.79r = 0.79. The critical value for 1616 pairs is 0.4970.497. (a) Describe the correlation. (b) The manager says selling fewer hot drinks would reduce injuries. Comment.

Try it first, then reveal one step at a time.

  1. (a) rr is close to 11 and 0.79>0.4970.79 > 0.497: strong, significant positive correlation.
Worked exampleFor 1111 towns, the number of gyms per 10 00010\,000 people and the mean life expectancy have r=0.74r = 0.74. The critical value for 1111 pairs is 0.6020.602. A headline says building more gyms will make people live longer. Comment on the headline.

Try it first, then reveal one step at a time.

  1. 0.74>0.6020.74 > 0.602: significant positive linear correlation.
Check yourself
Daily umbrella sales and traffic delays in a city have strong positive correlation. Which is the best explanation?
Check yourself
Over 1818 months, sales of sunglasses and of pool tickets have r=0.91r = 0.91; the critical value is 0.4680.468. Which comment is best?

The regression line of y on x

Lines drawn by eye differ from person to person. The regression line comes from a fixed rule.

Six points with a straight regression line through them. A short vertical dashed segment joins each point to the line, some above the line and some below. x y
The squared vertical distances add up to as little as possible.

Here aa is the and bb is the : y=mx+cy = mx + c with new letters. Your GDC finds aa, bb and rr together.

Worked exampleA shop tests eight used e-bike batteries: xx is the number of charge cycles, in hundreds, and yy is the capacity as a percentage of its value when new. xx: 1,2,3,4,5,6,8,91, 2, 3, 4, 5, 6, 8, 9. yy: 97.4,95.1,93.6,90.2,88.9,85.7,81.4,79.697.4, 95.1, 93.6, 90.2, 88.9, 85.7, 81.4, 79.6. (a) Use your GDC to find the regression line of yy on xx. (b) Estimate the capacity after 550550 charge cycles. Give your answers to 3 s.f.

Try it first, then reveal one step at a time.

  1. (a) Enter xx and yy in two lists and run linear regression: a=−2.27072…a = -2.27072\ldots, b=99.7734…b = 99.7734\ldots, r=−0.99787…r = -0.99787\ldots

Interpret them with the question's variables and units. bb only means something if x=0x = 0 makes sense and is near the data.

Worked exampleFor the e-bike batteries, the regression line is y=−2.27x+99.8y = -2.27x + 99.8. Interpret a=−2.27a = -2.27 and b=99.8b = 99.8 in context.

Try it first, then reveal one step at a time.

  1. aa: for each extra 100100 charge cycles, the capacity falls by about 2.272.27 percentage points.
Worked exampleThe regression line of daily bus passengers yy (thousands) on petrol price xx (dollars per litre) is y=14.2x+21.5y = 14.2x + 21.5, for prices from 1.401.40 to 2.202.20. (a) Interpret 14.214.2. (b) Explain why 21.521.5 has no real meaning. (c) Find the change in passengers when the price rises by 0.200.20.

Try it first, then reveal one step at a time.

  1. (a) Each extra dollar per litre goes with about 14.214.2 thousand more daily passengers, on average.
Check yourself
In y=−2.27x+99.8y = -2.27x + 99.8 (xx in hundreds of cycles), what does −2.27-2.27 mean?
Check yourself
A runner's time yy minutes on air temperature xx °C is y=0.35x+41.2y = 0.35x + 41.2, from races at 1212 to 3030 °C. What is 41.241.2?

Reliable predictions

Trust a prediction from the yy on xx line only if the correlation is strong, xx is inside the data, and you are predicting yy.

Inside the data is . Outside is : the trend may not carry on there.

The line minimises vertical distances, which suits predicting yy. It was not fitted to predict xx, so rearranging it is not reliable.

Worked exampleFor the e-bike batteries (xx from 11 to 99, r=−0.998r = -0.998), estimate the capacity after (a) 700700 cycles and (b) 50005000 cycles. Comment on each.

Try it first, then reveal one step at a time.

  1. (a) x=7x = 7: y=−2.27072…×7+99.7734…=83.878…≈83.9%y = -2.27072\ldots \times 7 + 99.7734\ldots = 83.878\ldots \approx 83.9\%. Interpolation with rr near −1-1: reliable.
Worked exampleA battery has 84%84\% capacity. Explain why you should not solve 84=−2.27x+99.884 = -2.27x + 99.8 to estimate its charge cycles.

Try it first, then reveal one step at a time.

  1. That rearranges the yy on xx line to predict xx.
Check yourself
The e-bike data cover 100100 to 900900 cycles. Which prediction is most reliable?
Check yourself
You have the line of exam mark yy on revision hours xx. Which is correct for finding the hours that give a mark of 7070?

Common mistakes

  • Writing only aa and bb. Give the line as an equation, such as y=−2.27x+99.8y = -2.27x + 99.8.
  • Giving too few figures, such as r=0.85r = 0.85 for 0.847…0.847\ldots. Give 3 s.f., and predict with the full GDC values.
  • Rearranging the yy on xx line to predict xx. It is built to predict yy only.
  • Interpreting aa without context, or saying only that yy rises. Say how much yy changes per unit of xx.
  • Claiming causation because rr is close to 11. Correlation does not imply causation.

Exam tips

  • Write down rr: read it off your GDC, to 3 s.f. with its sign.
  • Estimate: write the substitution into the line before the answer. That earns the method mark.
  • Explain why an estimate may be unreliable: extrapolation, weak correlation, or predicting xx from a yy on xx line, in context.

Key takeaways

Learn thisDescribe correlation by direction (positive, negative or zero) and strength (strong, weak or none), in context.
Learn this−1≤r≤1-1 \le r \le 1
Learn thisPearson's rr measures linear correlation only: rr near 00 means no straight-line link, but there may be a curve.
Learn thisIf ∣r∣\lvert r\rvert is greater than the critical value for that number of pairs and significance level, the linear correlation is significant at that level.
Learn thisA line of best fit by eye and the regression line of yy on xx both pass through the mean point (xˉ,yˉ)(\bar{x}, \bar{y}).
Learn thisCorrelation does not imply causation: a third variable may drive both.
Learn thisIn the regression line y=ax+by = ax + b, aa is the predicted change in yy for each increase of 11 in xx, and bb is the predicted yy when x=0x = 0, which only means something if x=0x = 0 makes sense and is near the data.
Learn thisUse the yy on xx line only to predict yy, for xx inside the data range and when the correlation is strong; it cannot reliably predict xx from yy.

Practise this

23 past-paper questions on Correlation and regression in the AI HL bank, each with a mark scheme and a worked explanation.

Practise Correlation and regression →