Non-linear regression AI HL
Non-linear regression fits a curve instead of a straight line to paired data. You choose the type of curve from the scatter diagram and the context, the calculator finds the equation and the coefficient of determination, and you use the model to predict and to judge how far it can be trusted. A high coefficient of determination never settles the choice on its own, so every fit needs a sense check against the context.
Formulas at a glance
Only the linear regression line and the range of the correlation coefficient appear in the formula booklet. The non-linear forms below are not in the booklet: the calculator supplies the coefficients, but you must know which form belongs to which model and how to read its coefficients.
Linear regression line
In the bookletPearson correlation coefficient (linear data only)
In the bookletQuadratic model
Not in the bookletCubic model
Not in the bookletExponential model
Not in the bookletPower model
Not in the bookletSine model
Not in the bookletCoefficient of determination (any model)
Not in the bookletWhich method to use
Plot the data first and decide which family of curve matches the pattern and the context, then let the calculator find the coefficients.
| The question has | Use | Notes |
|---|---|---|
| Points that rise then fall (or fall then rise) once | Quadratic regression, | One turning point. The sign of shows whether it is a maximum or a minimum |
| Points with two turning points, or an S-shaped curve | Cubic regression, | Four coefficients, so a good fit is easier to get and a poor prediction is easier to make |
| A quantity multiplied by a constant factor for each equal step in | Exponential regression, | is growth and is decay. is the value at |
| A quantity that varies as a power of another, such as area against length | Power regression, | The curve passes through the origin when , and needs positive values of and |
| Data that repeat in a regular cycle | Sine regression, | The calculator may not give for a sine fit, so judge it from the graph and the context |
| Two or more models that both fit well | Compare , then the shape and the context | The highest does not decide the choice. alone is not a good way to choose between models |
| A prediction for a value of outside the data | Substitute into the model and comment on reliability | Predictions beyond the data are unreliable, because the curve may not keep the same shape |
Non-linear regression
Non-linear regression fits a curve rather than a line to bivariate data, and the coefficient of determination measures the proportion of the variability in accounted for by the model. You choose a model type that matches the scatter diagram, use technology to find its equation, and compare models using together with the context.
Choosing a model
The forms of the quadratic, cubic, exponential, power and sine models are in the formulas at the top of the page. They are not in the formula booklet, so learn which pattern in the data belongs to which form. The calculator then supplies the coefficients and the coefficient of determination .
Key terms
What is a regression curve?
A regression curve is the curve of a chosen type that best fits the data, found by least squares: its coefficients make the sum of the squares of the residuals, , as small as possible. Technology gives the values of its coefficients, and a smaller means a closer fit for that model.
e.g. Fitting a quadratic gives an equation of the form , where technology supplies , and .
How do you choose the type of model?
Look at the scatter diagram and the context. Growth by a constant factor suggests an exponential model, repeating cycles suggest a sine model, and a single turning point suggests a quadratic.
e.g. A population that doubles every year suits , while the height of a thrown ball over time suits .
How is R-squared related to r for a linear model?
For a linear model, equals , the square of Pearson's correlation coefficient. For other types of model, is not used.
e.g. If , then .
Why can a model with a higher R-squared still be a poor choice?
only measures how well the model fits the given data. A model can fit well and still behave unrealistically outside the data, so the context must be considered as well.
e.g. A downward-opening quadratic fitted to a plant's growth might have yet predict negative heights later on.
Worked example, step by step
The question Calculator needed [6 marks]
A farmer applies different amounts of fertiliser to six identical plots of land. For tens of kilograms of fertiliser per hectare, the yield is tonnes per hectare.
: 2, 4, 6, 8, 10, 12
: 3.2, 4.8, 5.3, 5.9, 5.3, 4.4
The yield is modelled by .
(a) Use regression to find the values of , and , correct to 3 significant figures.
(b) Write down the value of .
(c) Use the model to find the amount of fertiliser, in kilograms per hectare, that gives the greatest yield.
Worked solution: worked example
Answer: (a) , , (b) (c) kilograms per hectare
Step 1 - Choose the model and enter the data.
Enter the -values in one list and the -values in a second list. The scatter diagram rises and then falls once, so the question's quadratic model is sensible. Choose quadratic regression and run it on the two lists.
Why? The shape of the data and the context both suggest one turning point, which is what a quadratic gives. The calculator then finds the curve that makes the sum of the squares of the residuals as small as possible.
Step 2 - Read the coefficients.
The calculator gives , and to 3 significant figures, so A1 - A1 - A1 -
Why? Each value is read straight from the regression output. The negative value of agrees with a curve that has a maximum.
Step 3 - Read the coefficient of determination.
With diagnostics switched on, the output also gives . A1 -
Why? This means about of the variability in the yield is accounted for by the model. It shows the quadratic fits these six plots closely, but alone does not prove the model is the best choice or reliable outside the data.
Step 4 - Find the greatest yield.
Graph the regression equation, with the unrounded coefficients stored by the calculator, and use the maximum tool on the graph. The maximum is at , where . M1 - Find the maximum point of the model (graph and maximum, or )
Why? The greatest yield is the maximum point of the model. The -coordinate is the amount of fertiliser. Using the stored unrounded equation avoids a rounding error from the 3 significant figure coefficients.
Step 5 - Convert to the units asked for.
The value of is in tens of kilograms, so the amount of fertiliser is kilograms per hectare. A1 - kilograms per hectare
Why? The question asks for kilograms per hectare, not tens of kilograms, so the answer is converted at the end.
A1
A1
A1
A1
M1 Find the maximum point of the model (graph and maximum, or )
A1 kilograms per hectare
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.
| 2 | 4 | 6 | 8 | |
| 5.2 | 20.8 | 46.8 | 83.2 |
Worked solution: practice question 1
| 1 | 2 | 3 | 4 | 5 | |
| 1.2 | 4.5 | 9.1 | 14.8 | 21.0 |
A model in the form can be created to fit this data.
Worked solution: practice question 2
| 0 | 1 | 2 | 3 | 4 | |
| 5 | 10 | 20 | 40 | 80 |
Worked solution: practice question 3
Your score so far: 0 out of 14 marks
Calculator steps: Make a scatter diagram, Fit a model (quadratic, cubic, exponential, power, sinusoidal)
Common mistakes
- Quoting for a non-linear model. Pearson's only measures linear correlation - for quadratic, exponential or power models, compare fits using instead.
- Treating the highest as automatically "correct". A model with more parameters (cubic over quadratic, say) can chase individual data points rather than the underlying trend - always sanity-check the shape against the scatter diagram too.
- Extrapolating a curved model far beyond the data. An exponential or power curve can shoot off to unrealistic values outside the range it was fitted on, even when inside that range is excellent.
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: Non-linear regression
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
Fit a model (quadratic, cubic, exponential, power, sinusoidal)
Used in: Non-linear regression
How to fit a model on a TI-84 Plus CE
Turn on R² (once) | |
R² stays hidden until diagnostics are switched on. Open the mode screen with mode, go down to the STAT DIAGNOSTICS line, choose ON with ▶ and confirm with enter. Leave with 2nd mode (QUIT). The setting lasts until the calculator is reset. |
|
Enter the data | |
Open the list editor with stat and 1:Edit. To empty a list, highlight its name (L1 or L2) at the top and press clear, then enter. |
|
Key the inputs into L1 one per line, with enter after each: 0, 1, 2, 3, 4, 5, 6, 7. Move across to L2 with ▶ and key the outputs the same way: 12, 18, 25, 36, 49, 70, 98, 141. The two lists need equal lengths. |
L1 = 0, 1, 2, 3, 4, 5, 6, 7 L2 = 12, 18, 25, 36, 49, 70, 98, 141 |
Choose the model and run it | |
Press stat and move to CALC with ▶. The curve fits are numbered in the menu: 5:QuadReg quadratic, |
|
For the example choose 0:ExpReg. 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 |
ExpReg y=a*b^x a=12.4068849 b=1.4142966 r²=0.9994408 r=0.9997204 |
Read a and b, and r² (the R² value). The same steps work for the other models; only the menu item changes. and , with the coefficients to 3 significant figures. |
|
Compare two models with R² | |
Run another model on the same lists: press stat, ▶ to CALC and choose 5:QuadReg, with Xlist L1 and Ylist L2 as before. The screen shows a, b, c and R². Compare the R² values of the models, then look at the graph before you decide. and . |
QuadReg y=ax²+bx+c a=2.8392857 b=-2.6011905 c=15.5416667 R²=0.9936753 |
Predict a value from the model | |
Before you run the regression, 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 when for the exponential model, to 1 decimal place. |
Y1(4.5) 59.0330102 |
A sinusoidal model | |
Enter the times in L1 and the depths in L2 (clear the old values first): L1 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24; L2 3.1, 5.6, 7, 6.4, 3.9, 1.6, 1.3, 3.4, 5.9, 7.1, 6.2, 3.8, 1.9. Then press stat, ▶ to CALC and choose C:SinReg. Leave Period empty when the times are equally spaced and in order, otherwise type a period guess. Move to Calculate and press enter. |
SinReg y=a*sin(bx+c)+d a=2.9173012 b=0.4526533 c=-0.3835108 d=4.2119403 |
The screen gives a, b, c and d and no R². The angle is always in radians, so put the calculator in radian mode before you use the stored equation. , with the coefficients to 3 significant figures. |
|
If R² does not appear, diagnostics are off: turn STAT DIAGNOSTICS on in the mode screen and run the regression again. Use the stored equation in Y1 rather than rounded coefficients when you predict.
The full guide: Fit a model (quadratic, cubic, exponential, power, sinusoidal)
See the full list of GDC guides for every calculator task.
Syllabus content covered
| Code | Syllabus content |
|---|---|
| AHL4.13 | Non-linear regression. Evaluation of least squares regression curves using technology. In examinations, questions may be asked on linear, quadratic, cubic, exponential, power and sine regression. Sum of square residuals () as a measure of fit for a model. The coefficient of determination (). gives the proportion of variability in the second variable accounted for by the chosen model. Evaluation of using technology. Awareness that many factors affect the validity of a model and the coefficient of determination, by itself, is not a good way to decide between different models. |
Official IB source: Mathematics: applications and interpretation subject brief (PDF, ibo.org).
Quick questions
Which non-linear regression models can I fit on my calculator?
A calculator can fit quadratic, cubic, exponential, power and sine regression curves from its statistics menu, alongside the usual linear regression option.
How do I know whether to use an exponential or a power model?
In an exponential model , is multiplied by a constant factor for each equal increase in . In a power model , varies as a power of , such as area against length. Use the scatter diagram and the context to decide.
Is it safe to predict outside the range of the data?
Predictions beyond the range of the data are unreliable, because the curve may not keep the same shape. Predictions inside the range are more trustworthy.
When would I use a sine model?
Use it when the data repeat in a regular cycle, such as the height of the tide or the hours of daylight through a year. The fitted equation has the form .
Ready to practise properly?
Practice questions on every section, marked instantly like the real exam.