Linear Regression (AA HL)

The regression line of yy on xx is the straight line y=ax+by=ax+b that models how yy changes with xx, and it passes through the mean point (x¯,y¯)(\bar{x},\bar{y}). Find aa and bb using technology, then substitute an xx-value to predict yy. It also covers interpreting aa and bb in context and the limits of prediction. It's part of the broader Bivariate Statistics topic.

19 questions on this sub-topic.

Syllabus

CodeSyllabus content
SL4.4Linear correlation of bivariate data; Pearson's product-moment correlation coefficient rr, found using technology. Scatter diagrams; lines of best fit by eye, through the mean point. Distinction between correlation and causation. Equation of the regression line of yy on xx, and use for prediction, including the dangers of extrapolation. Interpreting the parameters aa and bb in y=ax+by=ax+b.

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

Skills practised on this page:

The regression line

Regression line of y on x

y=ax+b, a=SxySxx, b=y¯−ax¯y=ax+b,\ a=\dfrac{S_{xy}}{S_{xx}},\ b=\bar y-a\bar x

Given on the formula booklet, but on paper you normally read aa and bb straight off your GDC's linear regression output rather than computing SxyS_{xy} and SxxS_{xx} by hand.

Using it for prediction

Substitute the xx-value into y=ax+by=ax+b.

Only reliable for xx-values inside the range of the original data - predicting outside that range is extrapolation, and the trend may not hold there.

Need the full syllabus wording and the wider statistics formula table? See Bivariate Statistics. For calculator steps, see the parent topic's GDC guidance.

Key terms

What does the gradient aa mean?

In y=ax+by=ax+b, the gradient aa is the predicted change in yy for each increase of one unit in xx. Its sign matches the direction of the correlation.

e.g. In y=3x+5y=3x+5, each extra unit of xx increases the predicted yy by 33.

What does the intercept bb mean?

bb is the predicted value of yy when x=0x=0. It may have no sensible meaning in context if x=0x=0 lies far outside the data.

e.g. In y=3x+5y=3x+5, the intercept b=5b=5 is the predicted yy when x=0x=0.

What is the difference between interpolation and extrapolation?

Interpolation predicts yy for an xx-value inside the range of the data, and is more reliable when the correlation is strong. Extrapolation predicts outside that range, where the linear pattern may not continue.

e.g. If the data cover xx from 1010 to 5050, predicting at x=30x=30 is interpolation but predicting at x=80x=80 is extrapolation.

What is the mean point?

The mean point is (x¯,y¯)(\bar{x},\bar{y}), whose coordinates are the mean of the xx-values and the mean of the yy-values. The regression line of yy on xx always passes through it.

e.g. If x¯=4\bar{x}=4 and y¯=17\bar{y}=17, the line y=3x+5y=3x+5 passes through (4,17)(4,17), since 3×4+5=173\times4+5=17.

Worked examples

1
Easy
No calc
[2 marks]

A regression line is y=3x+5.y = 3x + 5. Estimate yy when x=4.x = 4.

Worked solution

y=3(4)+5y = 3(4) + 5 M1
y=17.y = 17. A1

M1 Substituting x=4x=4 into the regression line A1 y=17y=17
2
Medium
GDC
[3 marks]

A data set gives r=0.88r = 0.88 and regression line y=1.5x+2y = 1.5x + 2.

(a) Describe the correlation.

(b) Estimate yy when x=10x = 10.

Worked solution

(a) r=0.88r = 0.88 is close to +1+1, giving a strong positive linear correlation. A1

(b) Estimate. y=1.5(10)+2y = 1.5(10) + 2 M1
y=17.y = 17. A1On the GDC. Estimate y when x = 10. The calculator shows about 17. The calculator steps below are for (b).

TI-84 Plus CE: 2nd mode then type 1.5(10) + 2 enterCasio fx-CG50: MENU Run-Matrix then type 1.5(10) + 2 EXECasio fx-CG100: HOME Calculate then type 1.5(10) + 2 EXETI-Nspire CX: home Calculator then type 1.5(10) + 2 enterFull GDC guide: Enter a calculation on the home screen Topic page

A1 Strong positive correlation M1 Substituting x=10x=10 into the regression line A1 y=17y=17
3
Hard
No calc
[5 marks]

The regression line of yy on xx is y=2x+5.y = 2x + 5. A new variable X=x+10X = x + 10 is used (a shift).

(a) Express the regression line of yy on X.X.

(b) State the effect of the shift on the correlation coefficient.

Worked solution

(a) x=X−10x = X - 10, so yy M1
y=2(X−10)+5y = 2(X - 10) + 5 A1
y=2X−15.y = 2X - 15. A1

(b) A shift (adding a constant) does not change rr M1
- correlation is invariant under translation. A1

M1 Substituting x=X−10x=X-10 into y=2x+5y=2x+5 A1 Correct Substitution A1 y=2X−15y=2X-15 M1 Effect of a shift A1 rr unchanged

Common mistakes

  • Extrapolating beyond the data range. Using the regression line to predict far outside the xx-values that were actually collected is unreliable, since there's no evidence the linear trend continues.
  • Using the y on x line to predict x from y. The two regression lines are generally different - predicting xx from a given yy needs the xx on yy line, not a rearrangement of the yy on xx line.
  • Rounding aa and bb too early. If you round the gradient and intercept before substituting, small errors compound - carry extra decimal places (or use exact GDC values) until the final answer.

Using your GDC

Every step below is a real button sequence, not a vague "use your calculator" hint - covering the TI-84 Plus, TI-Nspire, and Casio fx-9860/fx-CG50. Pick your model to filter down to just the steps that apply to you.

Show steps for:
Linear regression (line of best fit) and r

Gives the regression line and the correlation coefficient in one step - the core skill for this whole topic.

  1. Enter x-values in one list and y-values in another.
  2. Turn on DiagnosticOn once (2nd → CATALOG) so rr appears; then STAT → CALC → 4:LinReg(ax+b), set Xlist and Ylist, Calculate.TI-84
  3. Calculator page → menu → Statistics → Stat Calculations → Linear Regression (mx+b).Nspire
  4. Statistics menu → CALC (F2) → REG (F3) → X (linear); rr shows automatically.Casio
  5. Read aa (gradient), bb (intercept), rr (correlation) and r2r^2 (coefficient of determination).
  6. Use the equation to predict - but only within the data range (interpolation).

Tip: rr near ±1\pm1 means a strong linear fit; near 00 means weak. r2r^2 is the proportion of variation explained.

Build and manipulate lists

Lists let you store paired data sets without re-entering values - essential for setting up xx and yy columns before running a regression.

  1. Enter data manually: go to the list editor and type xx-values and yy-values into two separate lists.
  2. 2nd → STAT (LIST) → OPS lets you sort or clear a list. Use L1 for xx, L2 for yy, and reference both together in LinReg.TI-84
  3. In a Lists & Spreadsheet page, use two named columns for xx and yy so both are available together for regression.Nspire
  4. In Statistics list editor, enter xx-values in List 1 and yy-values in List 2 before running REG.Casio
  5. Keep the xx and yy lists the same length and in matching pairs - a mismatched row shifts every pair after it.

Tip: Double-check the lists are paired correctly before running a regression - a single mistyped value can shift rr noticeably.

See the full GDC guide for more calculator models and topics.

Quick questions

What is the equation of the regression line of y on x?

y=ax+by = ax + b, where a=SxySxxa = \dfrac{S_{xy}}{S_{xx}} and b=y¯−ax¯b = \bar y - a\bar x. In practice you read aa and bb directly off your GDC's linear regression output.

Why shouldn't I use the regression line to extrapolate?

The line only models the trend across the xx-values actually collected. Outside that range there's no evidence the linear pattern continues, so a prediction there can be unreliable or meaningless.

How do I know if a prediction from the regression line is reliable?

It is more reliable when |r||r| is close to 11 and the xx-value lies within the range of the data. A weak correlation, or an xx-value outside the data range, makes the prediction unreliable.

Can I use the line of y on x to predict x from a given y?

No. The line is built to predict yy from xx, so substituting a yy-value to find xx is not valid.

How do I calculate a prediction for a given x-value?

Substitute the xx-value into the equation of the line. For y=1.5x+2y=1.5x+2 and x=10x=10, y=1.5×10+2=17y=1.5\times10+2=17.

Ready to practise properly?

19 linear-regression questions, marked instantly like the real exam.