Correlation and Regression AA SL

Correlation tells you how strongly two variables move together, and a regression line lets you predict one from the other. This page shows how to find and describe Pearson's correlation coefficient, how to find the regression line of yy on xx and of xx on yy with your calculator, and how to judge whether a prediction can be trusted, with worked examples and exam-style questions.

Formulas at a glance

Pearson's rr and the regression lines are found with the calculator, so there is no formula to learn or substitute into. What you must know is how to read the results and how far to trust a prediction.

Strength and direction of linear correlation

rr (Pearson's coefficient)

Not in the booklet

Regression line of yy on xx, for predicting yy

y=ax+by = ax+b

Not in the booklet

Regression line of xx on yy, for predicting xx

x=cy+dx = cy+d

Not in the booklet

The point every yy on xx regression line passes through

Mean point (x¯,y¯)(\bar{x}, \bar{y})

Not in the booklet

Which method to use

Use the correlation coefficient and the scatter diagram to judge the relationship, then the right regression line to predict.

The question asks you toUseNotes
Describe the strength and direction of a linear relationshipPearson's rrThe sign gives the direction. For the size, |r||r| from 0 to 0.5 is weak, 0.5 to 0.8 is moderate and 0.8 to 1 is strong
Find rr from a table of paired dataEnter the two lists and run linear regression on the calculatorEnter the xx-values and yy-values in matching order
Say whether one variable causes the otherCorrelation does not imply causationName a possible third variable that could affect both
Decide whether a straight line is a suitable modelLook at the scatter diagram as well as rrA curved pattern can still give a high rr
Find the regression line of yy on xxLinear regression on the calculator, y=ax+by=ax+bKeep the unrounded values stored for later working
Predict yy from a given xxThe regression line of yy on xxSubstitute the value of xx into y=ax+by=ax+b
Predict xx from a given yyThe regression line of xx on yyRun the regression again with the lists swapped. Do not rearrange the yy on xx line
Find the line, or a missing value, from the mean pointThe regression line passes through (x¯,y¯)(\bar x,\bar y)Substitute the mean point into the equation, and the two regression lines meet at the mean point
Interpret the line in contextThe gradient is the change in yy for each increase of 1 in xxUse the units in the question. The intercept is the value of yy when x=0x=0, which may not make sense
Comment on the reliability of a predictionInside the range of the data is interpolation, outside it is extrapolationExtrapolation is unreliable because the pattern may not continue

Section 1 of 2 SL4.4

Correlation and scatter diagrams

Correlation describes the strength and direction of a linear relationship between two variables, measured by Pearson's product-moment correlation coefficient rr, where −1≤r≤1-1\le r\le1. A regression line of yy on xx, found using technology, gives an equation y=ax+by=ax+b used to predict yy from xx. Interpret both in context, with care over causation and extrapolation.

Correlation and regression, in brief

Correlation and causation

A strong correlation coefficient shows two variables move together, but it never proves that one causes the other - a third factor could be driving both.

Using a regression line far outside the data range (extrapolation) makes any estimate unreliable, since the linear trend isn't guaranteed to continue.

Key terms

What do aa and bb mean in y=ax+by=ax+b?

The gradient aa is the predicted change in yy for each increase of 11 in xx, and bb is the predicted value of yy when x=0x=0. Always interpret them in the context of the data.

e.g. For y=2.5x+40y=2.5x+40 with xx hours of study and yy a test mark, each extra hour is predicted to add 2.52.5 marks, and 4040 is the predicted mark for no study.

What is a scatter diagram?

A scatter diagram plots each pair of values as a point, with one variable on each axis. Its pattern shows the direction and strength of any linear relationship.

e.g. The points (1,3)(1,3), (2,5)(2,5), (3,7)(3,7) and (4,9)(4,9) lie on a straight line rising to the right, so the correlation is positive.

What do positive and negative correlation mean?

Positive correlation means yy tends to increase as xx increases, so r>0r>0. Negative correlation means yy tends to decrease as xx increases, so r<0r<0.

e.g. A value r=−0.9r=-0.9 shows strong negative correlation, while r=0.3r=0.3 shows weak positive correlation.

What does the regression line of yy on xx pass through?

It passes through the mean point (x¯,y¯)(\bar x,\bar y). Use it to predict yy for a given xx within the range of the data.

e.g. If x¯=4\bar x=4 and y¯=10\bar y=10, the line passes through (4,10)(4,10).

Worked example, step by step

The question Calculator needed [4 marks]

A librarian records, for seven pupils, the time xx hours spent on screens in a week and the number of pages yy read in the same week.

xx: 4, 6, 9, 12, 15, 18, 20
yy: 150, 160, 120, 112, 98, 62, 84

(a) Find the value of Pearson's product-moment correlation coefficient, rr.

(b) Describe the correlation between xx and yy.

(c) The librarian says that the data prove that more time on screens causes pupils to read fewer pages. Comment on this claim.

Worked solution: worked example

Answer: (a) r=−0.938r=-0.938. (b) Strong negative linear correlation. (c) The claim is not justified: correlation does not imply causation, and another factor could affect both.

Step 1 - Enter the data.

Put the seven values of xx in one list and the seven values of yy in a second list, in the same order, so that each pair (x,y)(x,y) lines up. Choose linear regression (or two-variable statistics) to get rr. M1 - Enter the data and use the calculator to find rr

Why? The calculator pairs the nnth entry of one list with the nnth entry of the other. If one list is shifted or a value is mistyped, every result after it is wrong.

Step 2 - Read off rr.

r=−0.938(3 s.f.).r=-0.938\quad(3\text{ s.f.}). A1 - r=−0.938r=-0.938

Why? You do not calculate rr by hand. Copy the value the calculator gives for rr, not for r2r^2, and keep its sign.

Step 3 - Describe the correlation.

The sign is negative, so as xx increases yy tends to decrease. Also 0.8<|r|≤10.8<|r|\le 1, so the correlation is strong. There is strong negative linear correlation\textbf{strong negative linear correlation} between screen time and pages read. A1 - Strong negative linear correlation

Why? A full description needs both the strength and the direction, and the word linear, because rr only measures how close the points are to a straight line.

Step 4 - Comment on causation.

A strong correlation shows that the two variables are associated, but it does not show that one causes the other. Another variable could affect both: for example, tired pupils may spend more time on screens and also have less energy to read. R1 - Correlation does not imply causation, with a possible other factor

Why? This is the standard exam point: correlation does not imply causation. A good answer names a possible third variable rather than only repeating the sentence.

Step 5 - Check.

The points fall from left to right, which matches a negative rr. The value satisfies −1≤r≤1-1\le r\le 1, and it is close to −1-1, so the points lie fairly close to a falling straight line.

Why? A sign that does not match the trend is the usual sign of a mistake, such as entering the lists the wrong way round or mistyping a value.

Marks (4):
M1 Enter the data and use the calculator to find rr
A1 r=−0.938r=-0.938
A1 Strong negative linear correlation
R1 Correlation does not imply causation, with a possible other factor

Now you try: enter your answers to be marked

These are real practice questions. Type your answer in each box and press Mark it. The worked solution and mark scheme appear straight away, and your first attempt is the one that counts. Use the keyboard for powers, roots and trig, and the working box for your notes.

1
Easy
No calc
[2 marks]
The mean point is (x¯,y¯)=(5,14)(\bar x,\bar y)=(5, 14) and lies on y=2x+c.y=2x+c. Find c.c.
[2]
Fractions & powers
Other

Worked solution: practice question 1

2
Medium
Calculator
[3 marks]
For data
xx12345
yy25589
, find Pearson's correlation coefficient rr, to 4 decimal places.
[3]
Fractions & powers
Other

Worked solution: practice question 2

3
Medium
Calculator
[3 marks]
The table shows five data points.

xx12345
yy25589


Find the equation of the regression line of yy on xx.
[3]
Fractions & powers
Other

Worked solution: practice question 3

Your score so far: 0 out of 8 marks

Common mistakes

  • Claiming correlation proves causation. A strong rr value shows two variables move together; it never establishes that one causes the other, since a third factor could explain both.
  • Extrapolating a regression line beyond the data range. Using y=2.4x+1.5y=2.4x+1.5 to estimate yy at x=50x=50 when the data only covers x=1x=1 to 99 produces an estimate with no guarantee of validity - the linear pattern might not continue.
  • Mixing up yy on xx with xx on yy. The two regression lines are not the same line rearranged - if a question asks you to predict xx from a given yy, you need the regression line of xx on yy, not the line of yy on xx solved for xx.

Try some questions on correlation and scatter diagrams

Section 2 of 2 SL4.4 SL4.10

Regression lines and prediction

When you have two connected sets of data, correlation tells you how strongly they move together, and regression gives you the actual line for predicting one from the other. This section covers Pearson's correlation coefficient rr, fitting and interpreting the regression line of yy on xx, using that line to make predictions, and knowing when a prediction can and can't be trusted.

Key terms

Five words worth knowing cold, each with an example showing what it means.

What is Pearson's r?

Pearson's product-moment correlation coefficient rr is a number between −1-1 and 11 that measures how strongly two variables follow a straight-line pattern. Values near ±1\pm1 mean a strong linear relationship; values near 0 mean little or no linear relationship. Your GDC calculates it directly from the data.

e.g. r=0.999r = 0.999 for data on hours of sunlight against plant height means an almost perfect positive linear relationship.

What is the regression line of y on x?

The regression line of yy on xx is the "line of best fit" that minimises the total squared vertical distance between the line and each data point. It's written y=ax+by = ax+b, and it's the line you use whenever you're predicting yy from a given xx.

e.g. For temperature xx and sales yy, y=10.2x−76.4y = 10.2x - 76.4 predicts sales for any given temperature within the data range.

What is the mean point?

The mean point (x¯,y¯)(\bar{x}, \bar{y}) is the point formed from the mean of the xx-values and the mean of the yy-values. Every regression line of yy on xx passes exactly through this point, which makes it a useful check on a calculated regression equation.

e.g. For x:3,4,5,6,7,8x: 3,4,5,6,7,8 and y:8,11,14,17,20,24y: 8,11,14,17,20,24, x¯=33/6=5.5\bar{x} = 33/6 = 5.5 and y¯=94/6=15.67\bar{y} = 94/6 = 15.67.

What is extrapolation?

Extrapolation is using a regression line to predict a value of yy for an xx that lies outside the range of the original data. This is unreliable because there's no evidence the same linear relationship continues beyond the data actually collected.

e.g. If xx ranges from 33 to 1717 in the data, predicting at x=50x=50 is extrapolation and the result should be treated with caution.

What does the gradient of a regression line mean?

The gradient aa in y=ax+by=ax+b tells you, in context, how much yy changes for every one-unit increase in xx. Interpreting it correctly means stating both the size of the change and the units of xx and yy from the original question.

e.g. For y=2.91x+3.41y = 2.91x + 3.41 with xx in $100s of marketing spend and yy in new customers, each extra $100 spent is associated with about 3 more new customers.

y on x and x on y

These are two different lines that both pass through the mean point but are otherwise not the same - picking the wrong one is a common source of lost marks.

FeatureRegression of y on xRegression of x on y
Formy=ax+by = ax+bx=cy+dx = cy+d
Minimises errors inthe yy-directionthe xx-direction
Use to predictyy from a given xxxx from a given yy
Exampley=0.8x+2y=0.8x+2x=0.9y−1.2x=0.9y-1.2

Correlation and its interpretation

Reading r

−1≤r≤1-1 \le r \le 1

The sign gives the direction. For the strength, |r||r| from 0 to 0.5 is weak, 0.5 to 0.8 is moderate and 0.8 to 1 is strong.

Not in the formula booklet - found by GDC

Using the regression line for prediction

Interpolation

Predicting within the range of the given xx-data.

Generally reliable, since the model is only tested inside this range.

Not in the formula booklet - key exam idea

Extrapolation

Predicting outside the range of the given data.

Unreliable - always flag this in your answer if the value of xx falls outside the data range.

Not in the formula booklet - key exam idea

Worked example, step by step

The question Calculator needed [6 marks]

A fitness club records, for seven members, the time xx hours spent training in a week and the resting heart rate yy beats per minute.

xx: 2, 4, 5, 7, 8, 10, 12
yy: 78, 75, 73, 67, 66, 63, 57

(a) Find the equation of the regression line of yy on xx.

(b) Interpret the gradient of the line in this context.

(c) Estimate the resting heart rate of a member who trains for 11 hours in a week.

(d) Explain why the line should not be used to estimate the resting heart rate of a member who trains for 25 hours in a week.

Worked solution: worked example

Answer: (a) y=−2.09x+82.8y=-2.09x+82.8. (b) Each extra hour of training per week is predicted to reduce the resting heart rate by about 2.092.09 beats per minute. (c) 59.859.8 beats per minute. (d) 2525 hours is outside the data range, so this is extrapolation and the estimate is unreliable.

Step 1 - Enter the data and run the regression.

Put the xx-values in one list and the yy-values in a second list, in the same order. Run linear regression with xx as the explanatory variable and yy as the response variable. M1 - Attempt linear regression of yy on xx on the calculator

Why? The question asks for the line of yy on xx, so xx is the variable you are predicting from. Swapping the lists would give the line of xx on yy, which is a different line.

Step 2 - Write the equation.

The calculator gives a=−2.094…a=-2.094\ldots and b=82.788…b=82.788\ldots, so y=−2.09x+82.8.y=-2.09x+82.8. A1 - y=−2.09x+82.8y=-2.09x+82.8

Why? Give the equation in the form y=ax+by=ax+b with 3 significant figures. Keep the unrounded values stored on the calculator for any later calculation.

Step 3 - Interpret the gradient.

The gradient is −2.09-2.09. For each extra hour of training per week, the resting heart rate is predicted to fall by about 2.092.09 beats per minute. A1 - Each extra hour of training reduces the resting heart rate by about 2.092.09 beats per minute

Why? The gradient is the change in yy for an increase of 11 in xx. Give it with the units from the question and say that it is a prediction.

Step 4 - Predict within the range.

Substitute x=11x=11: y=−2.094…(11)+82.788…=59.8.y=-2.094\ldots(11)+82.788\ldots=59.8. The estimated resting heart rate is 59.859.8 beats per minute. M1 - Substitute x=11x=11 into the regression line A1 - 59.859.8

Why? The data cover 2≤x≤122\le x\le 12, so x=11x=11 is inside the range. Predicting inside the range is interpolation, and it is reasonably reliable.

Step 5 - Explain the extrapolation.

The data only cover 22 to 1212 hours. A value of 2525 hours is far outside this range, so using the line is extrapolation. The line would give −2.094…(25)+82.788…=30.4-2.094\ldots(25)+82.788\ldots=30.4, which is not a realistic resting heart rate. R1 - 2525 is outside the range of the data, so this is extrapolation and unreliable

Why? There is no evidence that the straight-line pattern continues beyond the data. Say that the value lies outside the range of the data, and use the context to show why the result is doubtful.

Step 6 - Check.

The mean point is (x¯,y¯)=(6.857…,68.43…)(\bar x,\bar y)=(6.857\ldots,\,68.43\ldots). Then −2.094…(6.857…)+82.788…=68.43…-2.094\ldots(6.857\ldots)+82.788\ldots=68.43\ldots, so the line passes through the mean point.

Why? Every regression line of yy on xx passes through (x¯,y¯)(\bar x,\bar y). A line that misses it was entered or read wrongly. The negative gradient also matches the falling pattern in the table.

Marks (6):
M1 Attempt linear regression of yy on xx on the calculator
A1 y=−2.09x+82.8y=-2.09x+82.8
A1 Each extra hour of training reduces the resting heart rate by about 2.092.09 beats per minute
M1 Substitute x=11x=11 into the regression line
A1 59.859.8
R1 2525 is outside the range of the data, so this is extrapolation and unreliable

Now you try: enter your answers to be marked

1
Medium
No calc
[5 marks]
For a set of bivariate data, the regression line of yy on xx is y=0.5x+3y=0.5x+3 and the regression line of xx on yy is x=1.5y−2x=1.5y-2.
(a) Find the coordinates of the mean point, (x¯,y¯)(\bar{x},\bar{y}).
[3]
(b) Use the regression line of yy on xx to estimate yy when x=12x=12.
[2]
Fractions & powers
Other

Worked solution: practice question 1

Your score so far: 0 out of 5 marks

Try some questions on regression lines and prediction

Common mistakes

The four slip-ups that account for most of the marks lost on this topic - worth reading before you start practising, not just after you get one wrong.

  • Using the y on x line to predict x. The regression line of yy on xx is designed to predict yy from a given xx - to predict xx from a given yy, you need the separate regression line of xx on yy.
  • Ignoring extrapolation. Predicting a value far outside the range of the collected data assumes the linear trend continues, which is often not a safe assumption - always check the xx-value against the data range before trusting a prediction.
  • Assuming a high r means a linear model is appropriate. rr only measures linear association and can still be high for a clearly curved relationship - always check the scatter diagram, not just the value of rr.
  • Treating correlation as causation. A strong rr shows two variables move together, not that one causes the other - other factors could explain the relationship.

Using your GDC

The exact key presses for the TI-84 Plus CE, Casio fx-CG50, Casio fx-CG100 and TI-Nspire CX, with what the screen shows. Pick your calculator.

Make a scatter diagram

Used in: Correlation and scatter diagrams

How to make a scatter diagram on a TI-84 Plus CE

Scatter plot from two lists (STAT PLOT)

If L1 and L2 already hold data, press stat, choose 4:ClrList, then press 2nd 1 (L1) , 2nd 2 (L2) and enter to empty them.

ClrList L1,L2

Press stat, choose 1:Edit and press enter. Type the x-values into L1, pressing enter after each: 2, 3, 5, 6, 8, 9, 11, 12. Press ▶ to move to L2 and type the y-values in the same order: 31, 38, 40, 52, 55, 63, 60, 74. The two lists must have the same number of values.

L1    L2    L3
2     31    ---
3     38    ---
5     40    ---
6     52    ---
8     55    ---
9     63    ---
11    60    ---

Press 2nd Y= (STAT PLOT), choose 1:Plot1 and press enter. Highlight On and press enter. Check that Type is the first icon (scatter plot), Xlist is L1 and Ylist is L2. If not, move to the item, press enter to choose the icon, or type the list name with 2nd 1 (L1) or 2nd 2 (L2).

Plot1
On  Off
Type: scatter (first icon)
Xlist:L1
Ylist:L2

Press zoom and choose 9:ZoomStat. The calculator sets the window to fit the data and draws the scatter plot. Press trace and ◀ ▶ to move from point to point and read each pair of values.

The points rise from the lower left to the upper right: as x increases, y increases.

When you have finished, press 2nd Y= (STAT PLOT) and choose 4:PlotsOff. A plot left on makes the next function graph fail with an error.

The full guide: Make a scatter diagram

Linear regression (line of best fit) and r

Used in: Correlation and scatter diagrams, Regression lines and prediction

How to find a line of best fit and r on a TI-84 Plus CE

Turn on r (once)

Press mode, use ▼ to reach STAT DIAGNOSTICS, move to ON with ▶ and press enter. Then press 2nd mode (QUIT). With diagnostics off, the correlation coefficient rr is not shown. This setting stays on until you reset the calculator.

Enter the data and run LinReg(ax+b)

Press stat and choose 1:Edit. Clear any old values: move up to the L1 heading, press clear then enter, and do the same for L2.

Type the xx-values into L1, pressing enter after each: 3, 5, 6, 8, 9, 11, 12, 14. Press ▶ to move to L2 and type the yy-values, pressing enter after each: 41, 48, 47, 58, 60, 69, 66, 77. Both lists must have the same number of values.

L1 = 3, 5, 6, 8, 9, 11, 12, 14
L2 = 41, 48, 47, 58, 60, 69, 66, 77

Press stat, move to CALC with ▶, and choose 4:LinReg(ax+b). With the Stat Wizards on, a screen asks for Xlist and Ylist: set Xlist to L1 and Ylist to L2 (press 2nd 1 for L1 and 2nd 2 for L2), then move to Calculate and press enter. If the Stat Wizards are off, type LinReg(ax+b) L1,L2 and press enter.

LinReg(ax+b)
y=ax+b
a=3.2346939
b=30.7551020
r²=0.9678131
r=0.9837749

Read a (the gradient), b (the yy-intercept) and r.

y=3.23x+30.8y = 3.23x + 30.8 and r=0.984r = 0.984, both to 3 significant figures.

Predict a value from the line

Before you run LinReg, move to Store RegEQ on the wizard screen, press vars, then ▶ to Y-VARS and choose 1:Function then 1:Y1. The full-accuracy equation is then saved in Y1. On the home screen type Y1(10) and press enter.

y=63.1y = 63.1 when x=10x = 10, to 3 significant figures.

Y1(10)
63.1020408

If r does not appear, diagnostics are off: turn STAT DIAGNOSTICS on in the mode screen and run LinReg again. Use the full values of a and b, not rounded ones, when you predict.

The full guide: Linear regression (line of best fit) and r

See the full list of GDC guides for every calculator task.

Syllabus content covered

CodeSyllabus content
SL4.4Linear correlation of bivariate data. Pearson's product-moment correlation coefficient, rr. Scatter diagrams; lines of best fit, by eye, passing through the mean point. Equation of the regression line of yy on xx. Use of the equation of the regression line for prediction purposes. Interpret the meaning of the parameters, aa and bb, in a linear regression y=ax+by=ax+b.
SL4.10Equation of the regression line of xx on yy. Use of the equation for prediction purposes.

Official IB source: Mathematics: analysis and approaches subject brief (PDF, ibo.org).

Quick questions

What does Pearson's correlation coefficient r measure?

rr measures the strength and direction of the linear relationship between two variables, ranging from −1-1 (perfect negative) to +1+1 (perfect positive). A value near 00 means little or no linear correlation.

Does a value of r close to 1 prove that x causes y?

No. A strong correlation shows that the variables change together, but a third factor may affect both, or the link may be coincidence. Causation needs more evidence than correlation.

Why is extrapolation dangerous?

A regression line is only fitted to the data you have. Using it to predict far outside that range (extrapolation) assumes the same linear pattern continues, which often isn't true - the relationship can change, level off, or reverse beyond the data you actually collected.

Why can't I always use the y on x line to predict x?

The regression line of y on x is built to minimise errors in the y-direction, so it's optimised for predicting y from a given x. To reliably predict x from a given y, you need the separate regression line of x on y, which minimises errors in the x-direction instead.

Does r change if I change the units of the data?

No. Converting centimetres to metres, or adding a constant to every value, leaves rr unchanged. The gradient aa of the regression line does change, because it depends on the units.

Do I need to calculate r by hand?

No - the syllabus expects you to use your GDC to find r and the regression equation. Hand calculation is only there to help you understand what the value means, not something you'll be examined on directly. See the GDC guide for model-specific instructions.

Ready to practise properly?

Practice questions on every section, marked instantly like the real exam.