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.
Residual = observed y − predicted y. Points above the line have positive residuals and points below have negative ones.
A good linear model has residuals scattered randomly about 0, with no curve and no spreading out.
A U-shape or an arch in the residual plot means the relationship is curved: try a quadratic, exponential or power model.
r² close to 1 means the model explains most of the variation in y, not that the relationship is linear or causal.
Use the regression of y on x to predict y from x. Predictions outside the range of the data (extrapolation) are unreliable.
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.
GDC linear regression: y = 2.38x − 1.41, with r ≈ 0.983, so r² ≈ 0.966.
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.