Non-linear regression
Not every relationship is a straight line. Your GDC can fit quadratic, cubic, exponential, power and sine models by least squares. The skill the exam rewards is judging the fit: the sum of square residuals and measure it, but context decides which model makes sense.
1What you need to know
Tick these off as you go. By the end of the page you should be able to do all of them without notes.
- Use the GDC to find least squares regression curves: quadratic, cubic, exponential, power and sineAHL 4.13
- Calculate and interpret the sum of square residuals, AHL 4.13
- Find and interpret the coefficient of determination AHL 4.13
- Know that for a linear modelAHL 4.13
- Explain why alone is not a good way to choose between modelsAHL 4.13
- Use a model to predict, and comment on the reliability of the predictionAHL 4.13
2Notes & worked examples
Each idea is followed by a worked example. Try the question yourself first, then reveal the solution one step at a time.
A residual is the vertical gap between a data point and the model: observed minus predicted. The least squares model is the one that makes the total of the squared residuals as small as possible. Your GDC finds it for you; your job is to choose a sensible type of model and judge how well it fits.
2.1 The sum of square residuals
The smaller , the closer the model is to the data. It has the units of squared, so you can only compare it between models fitted to the same data.
2.2 The coefficient of determination
is the proportion of the variability in that is explained by the model. It lies between 0 and 1: means 95% of the variation in is accounted for by the model. For a linear model, , the square of Pearson’s correlation coefficient. (It can be shown that , so exactly when every point lies on the curve; you will not be examined on this.)
A bacteria culture is counted every hour.
| Time, hours | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|---|
| Bacteria, | 120 | 165 | 230 | 310 | 440 | 590 | 820 |
2.3 Choosing between models
A model with more parameters (a cubic rather than a quadratic) always fits at least as well, so can only go up. That does not make it a better model. Use together with: the context (should the model pass through the origin? grow without limit? level off?), the shape of the residuals, and how the model behaves outside the data.
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 2.3 | 5.6 | 11.2 | 16.0 | 23.4 | 29.6 |
Sine regression fits to periodic data such as hours of daylight or tides. The GDC needs enough points across at least one full cycle; read the period as (in radians) and check it makes sense, for example close to 365 days for daylight.
On the TI-Nspire, enter the data in two lists in a Lists & Spreadsheet page, then menu → Statistics → Stat Calculations and choose Quadratic, Cubic, Exponential, Power or Sinusoidal Regression. The output gives the parameters and (or ). Store the equation in f1 to graph it over a scatter plot. Note that the exponential and power are worked out from the logged data, which is the value the IB expects you to quote.
3Explore it
The six points are the data from WE3. Choose a model type: the curve is the least squares fit and the red lines are the residuals. The readout gives SSres and R² worked out on the original data (the GDC’s R² for exponential and power models uses the logged data, so it can differ slightly).
4Common mistakes & exam tips
Common mistakes
- Choosing the model with the highest without thinking about the context.
- Comparing for models fitted to different data sets.
- Rounding the parameters early, then using the rounded model for predictions.
- Calling a prediction outside the data range reliable because is high.
- Confusing with : for a linear model with negative correlation, is negative but is positive.
Exam tips
- Write the model with the parameters to at least 3 significant figures, and use the stored values for predictions.
- "Interpret " means a sentence: "about 99% of the variation in is explained by the model".
- Always mention extrapolation when predicting outside the data.
- Sketch or look at the data first: the shape usually suggests the model family.
5Practice
Fluency questions build the basics. Problem-solving questions make you think about which method to use.
6Exam-style questions
Original questions in the style of the IB Maths AI HL exam, with full markschemes. Your GDC is allowed throughout: use it, but write down what you entered and what it gave you. Give yourself about 1 minute per mark.
The braking distance of a car, metres, was measured at different speeds, km h⁻¹.
| Speed, km h⁻¹ | 20 | 30 | 40 | 50 | 60 | 70 |
|---|---|---|---|---|---|---|
| Distance, m | 6.1 | 11.8 | 20.5 | 30.2 | 42.6 | 56.0 |
- (a)Find a model of the form .[2]
- (b)Write down the value of for this model and interpret it.[2]
- (c)Use the model to estimate the braking distance at 90 km h⁻¹, and comment on the reliability of your estimate.[2]
| (a) | |
| A1 | |
| A1 | |
| (b) | |
| A1 | |
| 99.9% of the variation in braking distance is explained by the model | R1 |
| (c) | |
| m | A1 |
| not reliable: 90 is outside the data range (extrapolation) | R1 |
A cup of tea cools in a room. The difference between the tea’s temperature and room temperature, °C, is recorded every 5 minutes.
| Time, min | 0 | 5 | 10 | 15 | 20 | 25 | 30 |
|---|---|---|---|---|---|---|---|
| Temperature above room, °C | 62.0 | 47.5 | 36.1 | 28.4 | 21.0 | 16.3 | 12.5 |
- (a)Find an exponential model .[2]
- (b)Write down the value of .[1]
- (c)A quadratic model is also fitted. Find this model and its sum of square residuals.[2]
- (d)The exponential model has . Use your models to predict after 60 minutes, and hence explain which model is more suitable.[3]
| (a) | |
| A1 | |
| A1 | |
| (b) | |
| A1 | |
| (c) | |
| A1 | |
| A1 | |
| (d) | |
| exponential: °C | A1 |
| quadratic: °C | A1 |
| the exponential model is better: it has the smaller , and the quadratic wrongly predicts the tea warming up again | R1 |
For a set of data on hours of revision, , and test errors, , Pearson’s correlation coefficient is .
- (a)Find for the linear model and interpret it.[2]
- (b)A quadratic model has . State, with a reason, which model fits the data better.[1]
- (c)Give two reasons why alone should not be used to choose between the models.[2]
| (a) | |
| A1 | |
| 84.6% of the variation in errors is explained by the linear model | R1 |
| (b) | |
| quadratic, since | R1 |
| (c) | |
| a model with more parameters always has a higher (or equal) | R1 |
| the context matters, for example a quadratic would predict errors increasing again for large | R1 |
7Check yourself
Six quick questions, marked instantly. Aim for 6/6 before moving on. Fractions like 3/2 are accepted.
8Past-paper practice
Once you are scoring well above, try these real IB Maths AI HL questions on this topic. Your school or teacher will have the papers.
| Paper | Question | Focus | Difficulty |
|---|---|---|---|
| Nov 2024 · Paper 1 | Q12 | Heights of a bouncing ball: fitting a model with technology | ★★☆ |
| May 2025 · TZ2 · Paper 1 | Q14 | Comparing two regression models using | ★★☆ |
| May 2023 · TZ1 · Paper 2 | Q1 | Earth’s temperatures: choosing and using a regression model | ★★☆ |
| May 2025 · TZ1 · Paper 2 | Q3 | Population of Los Angeles: comparing models | ★★★ |
