HL AI · Statistics and Probability

Linear regression and residual analysis (IB Math AI HL)

Updated October 2026

Quick answer: The regression line of y on x minimises the sum of the squared residuals, where a residual is the observed y minus the predicted y. The coefficient of determination r² is the proportion of the variation in y that the line explains. A high r² is not enough: plot the residuals, and if they show a pattern, a curve fits better.

HL AI expects you to plot the residuals, check for randomness, and interpret r² as a measure of model fit.

Practise Linear regression and residual analysis with AI marking

Open the full HL AI engine — every question in this unit is worked through with instant AI-graded feedback on your handwritten workings.

Practise HL AI Statistics and Probability →

Key ideas

Worked example

For x = 1, 2, 3, 4, 5, 6 the values of y are 2.0, 3.1, 4.9, 7.4, 10.2, 13.9. Find the regression line of y on x and r², calculate the residuals, and comment on whether a linear model is suitable.

  1. GDC linear regression: y = 2.38x − 1.41, with r ≈ 0.983, so r² ≈ 0.966.
  2. Predicted values: 0.97, 3.35, 5.73, 8.11, 10.49, 12.87.
  3. Residuals (observed − predicted): 1.03, −0.25, −0.83, −0.71, −0.29, 1.03.
  4. The residuals are positive at both ends and negative in the middle: a U-shaped pattern, not random scatter.
  5. So although r² is high, the data curve upwards and a linear model is not the best choice. A quadratic model fits much more closely (R² ≈ 0.9998).

Answer: y = 2.38x − 1.41, r² ≈ 0.966; the residuals form a U-shape, so a curved (for example quadratic) model is more suitable.

Exam-style HL AI questions on this topic

Try it now

1 of 5

  1. Question 1 of 5
  2. Question 2 of 5
  3. Question 3 of 5
  4. Question 4 of 5
  5. Question 5 of 5

5 quick questions on regression and correlation. No sign-in needed.

The regression line of \(y\) on \(x\) is \(y = \frac{3 x}{4} + 20\). Estimate \(y\) when \(x = 40\).
Choose your answer · keys 1–4

Do it on your GDC

A GDC is allowed on every AI paper. Keystrokes for the TI-84 Plus CE, TI-Nspire CX II and Casio fx-CG50, with a checked worked example:

See it on a graph

Maths IA ideas that use linear regression and residual analysis

Related in Statistics and Probability

Revise Linear regression and residual analysis for the exam

Stretch yourself: original probability problems at Senior level (ages 16 to 18), with hints and full solutions: Problem S107 · Problem S101 · Problem S29 · Problem S102. All 20 →

More on this topic

FAQ

What does a residual plot show?

It shows how far each point is from the regression line. Random scatter about zero means the linear model is suitable. A clear pattern, such as a U-shape, means the relationship is not linear and another model would fit better.

Where can I practise linear regression and residual analysis questions?

On the Data Collection and Non-Linear Regression questions page: 23 exam-style HL AI questions with full mark schemes, plus free step-by-step worked examples.

Can I use my calculator for linear regression and residual analysis?

Yes: a GDC is allowed on every HL AI paper, so practise the calculator method as well as the working. The Regression and Correlation r and Spearman's rank guides give the keystrokes for the TI-84 Plus CE, TI-Nspire CX II and Casio fx-CG50.

What else is free here

Save your progress as you reviseA free account remembers the questions you have done on every topic and brings you back to this page.

Join free

Already have an account? Sign in