IB Maths Help logoIB Maths Help

Fit a model (quadratic, cubic, exponential, power, sinusoidal)

Pick a curve that suits your data, let the calculator find its equation, compare candidates with R² and predict from the result. Every route is given for the TI-84 Plus CE, Casio fx-CG50, Casio fx-CG100 and TI-Nspire CX, followed by how to set the answer out.

Used inAI HL

A regression command turns a table of data into an equation. Put the inputs in one list and the outputs in a second, then run the command for the curve you think fits: quadratic, cubic, exponential, power or sinusoidal. You get the parameters of the equation, plus R² for every model except the sinusoidal one. The scatter diagram and the context should suggest the curve; R² helps you choose between close candidates.

Example

The number of users of an app, yy thousand, is recorded xx years after its launch.
xx: 0, 1, 2, 3, 4, 5, 6, 7
yy: 12, 18, 25, 36, 49, 70, 98, 141
(a) Fit a model of the form y=abxy = ab^x and state R2R^2. (b) Estimate the number of users after 4.5 years.

xy12345674080120160

Exponential regression on the two lists gives (a) y=12.4×1.41xy = 12.4 \times 1.41^{x} with R2=0.9994R^2 = 0.9994, a very close fit, and (b) roughly 59.059.0 thousand users at 4.5 years, an estimate made between the first and last years recorded.

Choose your calculator

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, y=ax2+bx+cy = ax^2 + bx + c
6:CubicReg cubic, y=ax3+bx2+cx+dy = ax^3 + bx^2 + cx + d
0:ExpReg exponential, y=abxy = ab^x
A:PwrReg power, y=axby = ax^b
C:SinReg sinusoidal, y=asin⁡(bx+c)+dy = a\sin(bx + c) + d

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 L1,L2 and press enter.

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.

y=12.4×1.41xy = 12.4 \times 1.41^{x} and R2=0.9994R^2 = 0.9994, 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.

y=2.84x2−2.60x+15.5y = 2.84x^2 - 2.60x + 15.5 and R2=0.9937R^2 = 0.9937.

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 Y1(4.5) and press enter.

y=59.0y = 59.0 when x=4.5x = 4.5 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.

y=2.92sin⁡(0.453x−0.384)+4.21y = 2.92\sin(0.453x - 0.384) + 4.21, 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.

How to fit a model on a Casio fx-CG50

Enter the data

From MENU open Statistics, which starts in the List Editor.

Fill List 1 with the inputs, EXE after each value: 0, 1, 2, 3, 4, 5, 6, 7. Then fill List 2 with the outputs the same way: 12, 18, 25, 36, 49, 70, 98, 141. The lists need equal lengths.

List1 = 0, 1, 2, 3, 4, 5, 6, 7
List2 = 12, 18, 25, 36, 49, 70, 98, 141

Open F2 (CALC) and F6 (SET). 2Var XList should read List 1 and 2Var YList List 2. Leave the screen with EXIT.

Choose the model and run it

Press F2 (CALC) then F3 (REG). The first menu holds F3 (X²) for quadratic and F4 (X³) for cubic. Press F6 for the next menu, which holds Exp (F2), Power (F3) and Sin (F4).

For the example press F6, then F2 (Exp), then F2 (abx). The results screen shows a, b, r, r² and MSe. Choose abx for the form y=abxy = ab^x, not aebx.

y=12.4×1.41xy = 12.4 \times 1.41^{x} and R2=0.9994R^2 = 0.9994, with the coefficients to 3 significant figures.

Exponential Reg(abx)
a=12.4068849
b=1.4142966
r=0.9997204
r²=0.9994408
MSe=...

Compare two models with R²

Press EXIT to go back to the List Editor and run another model on the same lists, for example F2 (CALC), F3 (REG), F3 (X²). Compare the r² values of the models, then look at the graph before you decide.

y=2.84x2−2.60x+15.5y = 2.84x^2 - 2.60x + 15.5 and R2=0.9937R^2 = 0.9937.

Quadratic Reg
a=2.8392857
b=-2.6011905
c=15.5416667
r²=0.9936753
MSe=...

Predict a value from the model

With the results of the model on the screen, press F6 (DRAW). Then press SHIFT F5 (G-SOLVE) and F1 (Y-CAL), press EXE to choose the graph, type 4.5 and press EXE. The yy-value appears at the bottom of the screen. Press EXIT to finish.

y=59.0y = 59.0 when x=4.5x = 4.5 for the exponential model, to 1 decimal place.

X=4.5
Y=59.0330102

A sinusoidal model

Enter the times in List 1 and the depths in List 2: List 1 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24; List 2 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. Press F2 (CALC), F3 (REG), F6 and F4 (Sin). The screen gives a, b, c, d and MSe and no r².

y=2.92sin⁡(0.453x−0.384)+4.21y = 2.92\sin(0.453x - 0.384) + 4.21, with the coefficients to 3 significant figures.

Sinusoidal Reg
a=2.9173012
b=0.4526533
c=-0.3835108
d=4.2119403
MSe=...

Drawing a sine regression graph switches the angle unit to radians, but the coefficients are in radians whatever the setting. Use radian mode whenever you evaluate the equation yourself.

Check the model has the form your exam question expects: use abx, not aebx, for y = ab^x. A sinusoidal regression gives no r².

How to fit a model on a Casio fx-CG100

Enter the data

From HOME open Statistics; the List Editor tab is showing.

Fill List 1 with the inputs, EXE after each value: 0, 1, 2, 3, 4, 5, 6, 7. Then fill List 2 with the outputs the same way: 12, 18, 25, 36, 49, 70, 98, 141. The lists need equal lengths.

List1 = 0, 1, 2, 3, 4, 5, 6, 7
List2 = 12, 18, 25, 36, 49, 70, 98, 141

Choose the model and run it

Press the next-tab key to reach the Setup tab. Highlight the first line and press OK, then choose Calculate Summary Statistics and press OK.

Highlight line 2 and press OK, then choose the model: Quadratic Regression, Cubic Regression, Exp Regression (a·b^x), Power Regression or Sinusoidal Regression. For the example choose Exp Regression (a·b^x) for y=abxy = ab^x. Check that 2Var XList is List 1 and 2Var YList is List 2.

Calculate Summary Statistics
Exp Regression(a·b^x)
2Var XList: List1
2Var YList: List2

Press the next-tab key, or highlight Execute and press OK. The Results tab shows a, b, r, r² and MSe.

y=12.4×1.41xy = 12.4 \times 1.41^{x} and R2=0.9994R^2 = 0.9994, with the coefficients to 3 significant figures.

Exp Regression(a·b^x)
a=12.4068849
b=1.4142966
r=0.9997204
r²=0.9994408
MSe=...

Compare two models with R²

Go back to the Setup tab, change line 2 to another model such as Quadratic Regression, and execute again. The Results tab shows r² for the quadratic, cubic, exponential and power models, but not for the sinusoidal model. Compare the values, then look at the graph before you decide.

y=2.84x2−2.60x+15.5y = 2.84x^2 - 2.60x + 15.5 and R2=0.9937R^2 = 0.9937.

Quadratic Regression
a=2.8392857
b=-2.6011905
c=15.5416667
r²=0.9936753
MSe=...

Predict a value from the model

Go back to the Setup tab and choose Draw Statistics Graph on the first line. With Graph1 as a scatter plot of List 1 against List 2, press the next-tab key to draw it, then the next-tab key again and choose the regression model from the menu, and the next-tab key once more to draw the regression graph.

Press TOOLS and choose Graph Solve then y-Cal. Type 4.5 and press OK. The coordinates appear at the bottom of the window.

y=59.0y = 59.0 when x=4.5x = 4.5 for the exponential model, to 1 decimal place.

x=4.5
y=59.0330102

A sinusoidal model

Enter the times in List 1 and the depths in List 2: List 1 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24; List 2 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. Choose Sinusoidal Regression on line 2 of the Setup tab and execute. The Results tab shows a, b, c, d and MSe and no r².

y=2.92sin⁡(0.453x−0.384)+4.21y = 2.92\sin(0.453x - 0.384) + 4.21, with the coefficients to 3 significant figures.

Sinusoidal Regression
a=2.9173012
b=0.4526533
c=-0.3835108
d=4.2119403
MSe=...

Choose the form with b to the power x for y = ab^x, not the one with e. The sinusoidal regression gives no r².

How to fit a model on a TI-Nspire CX

Enter the data

From home open Lists & Spreadsheet. Name the lists in the top cells: x for column A and y for column B, each followed by enter.

Put the inputs down column A, enter after each value: 0, 1, 2, 3, 4, 5, 6, 7. Put the outputs down column B: 12, 18, 25, 36, 49, 70, 98, 141. The columns need equal lengths.

x: 0, 1, 2, 3, 4, 5, 6, 7
y: 12, 18, 25, 36, 49, 70, 98, 141

Choose the model and run it

Press menu → Statistics → Stat Calculations. Choose the model: Quadratic Regression, Cubic Regression, Exponential Regression (y=abxy = ab^x), Power Regression or Sinusoidal Regression.

For the example choose Exponential Regression. In the box, set X List to x and Y List to y (move between the fields with tab), then press enter on OK. Two new columns list the results: RegEqn, a, b, r² and r.

y=12.4×1.41xy = 12.4 \times 1.41^{x} and R2=0.9994R^2 = 0.9994, with the coefficients to 3 significant figures.

a=12.4068849
b=1.4142966
r²=0.9994408
r=0.9997204

Compare two models with R²

Run another model on the same columns: menu → Statistics → Stat Calculations → Quadratic Regression, with the same X List and Y List. The results include R² for the quadratic, cubic, exponential and power models. Compare the values, then look at the graph before you decide.

y=2.84x2−2.60x+15.5y = 2.84x^2 - 2.60x + 15.5 and R2=0.9937R^2 = 0.9937.

a=2.8392857
b=-2.6011905
c=15.5416667
R²=0.9936753

Predict a value from the model

In the regression box leave Save RegEqn To as f1 so the equation is stored as the function f1. On a Calculator page type f1(4.5) and press enter.

y=59.0y = 59.0 when x=4.5x = 4.5 for the exponential model, to 1 decimal place.

f1(4.5)
59.0330102

A sinusoidal model

Enter the times in column A and the depths in column B: column A 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24; column B 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. Choose Sinusoidal Regression. The box has X List and Y List and also Iterations and Period: leave Period at its default for equally spaced times, or type a period guess. The results are a, b, c and d, with no R².

y=2.92sin⁡(0.453x−0.384)+4.21y = 2.92\sin(0.453x - 0.384) + 4.21, with the coefficients to 3 significant figures.

a=2.9173012
b=0.4526533
c=-0.3835108
d=4.2119403

The angle is always in radians, so put the document in radian mode before you evaluate f1 for a sinusoidal model.

Give the lists names such as x and y and keep Save RegEqn To as f1. The results are linked to the data, so if you correct a value in the columns the model updates.

Sources. Key presses follow the manufacturers' documentation: the TI-84 Plus CE eGuide, the TI-Nspire eGuide, the Casio fx-CG50 Software User's Guide (version 3.30) and the Casio fx-CG100 online manual.

What to write in the exam

  • Write the equation of the model with its parameters to 3 significant figures, for example y=12.4×1.41xy = 12.4 \times 1.41^{x}, and note that technology found it. The key presses do not belong in the working.
  • Match the letters in the question. If the data are called NN and tt, give the model as NN in terms of tt.
  • When R² is asked for, quote it and interpret it: a value near 1 means the curve follows the data closely. A higher R² does not by itself make a model suitable, because the shape must also fit the context.
  • Stay within the data when you estimate. A value of xx between the smallest and largest in the table gives a trustworthy estimate (interpolation); one beyond them is extrapolation and needs a comment.
  • Calculators are allowed on every AI HL paper (check your syllabus), so regression is available throughout.

Choosing a model

Plot the data first (see making a scatter diagram) and let the shape and the context guide you.

Comparing models with R²

R² lies between 0 and 1, and the closer to 1 the more of the variation in yy the model accounts for. For the exponential and power models the calculators work R² out on the straightened data (ln⁡y\ln y against xx, or ln⁡y\ln y against ln⁡x\ln x), so compare it with the other models as a guide and check the fit on the graph as well. A cubic fits any data at least as well as a quadratic, so a higher R² alone does not make it the better choice. The sinusoidal regression does not give R². To find when a model reaches a given value, see solving an equation numerically.

Error messages and what to do

CalculatorMessageUsual causeWhat to try
TI-84 Plus CEERR:DOMAINAn exponential or power regression was run on data with a negative y-value (or a power regression with a negative x-value), which has no logarithm.Check the data, and choose a model that suits it.
TI-84 Plus CEERR:DIMENSION MISMATCHL1 and L2 do not have the same number of values.Open the list editor with STAT then 1:Edit and make both lists the same length.
TI-84 Plus CEERR:SINGULAR MATRIXSinReg or a polynomial regression could not find a solution, for example with too few data points.Check the data, add points if you can, and for SinReg type a period guess.
TI-84 Plus CEERR:STATThe lists are not suitable for the calculation, for example fewer than two data points.Check each list holds all your values.
Casio fx-CG50Dimension ERRORThe two lists do not have the same number of values.Make List 1 and List 2 the same length.
Casio fx-CG50Ma ERRORThe calculation went outside the allowed range, for example an exponential or power regression on data with a zero or negative value.Check the data, and choose a model that suits it.
Casio fx-CG100Dimension ERRORThe two lists do not have the same number of values.Make List 1 and List 2 the same length.
Casio fx-CG100Math ERRORThe calculation went outside the allowed range, for example an exponential or power regression on data with a zero or negative value.Check the data, and choose a model that suits it.
TI-Nspire CXDimension mismatchThe X List and Y List do not have the same number of values.Make columns A and B the same length.
TI-Nspire CXDomain errorAn exponential or power regression was run on data with a zero or negative value.Check the data, and choose a model that suits it.

Common mistakes

  • Putting the variables in the wrong lists. The input goes in the first list and the output in the second. Reversing them fits a different curve.
  • Missing R² on the TI-84 Plus CE. It is hidden while STAT DIAGNOSTICS is off, so switch it on in the mode screen and run the model again.
  • The wrong exponential form. For y=abxy = ab^x choose the form with bxb^x, not the one with ebxe^{bx}, or the parameters will not match the question.
  • Degrees instead of radians for a sinusoidal model. The calculator gives bb and cc in radians. Use radian mode when you evaluate the equation yourself.
  • Estimating from rounded parameters. Evaluate the stored equation, or keep every digit of the parameters, and round once at the end.
  • Trusting a model far outside the data. Even with R² close to 1, an estimate well beyond the recorded values may be wrong.

Try it yourself

Real questions from the IB Maths Help question bank. Type your answer and press Mark it: the worked solution and mark scheme then appear. Use your calculator to fit the model.

Practise with your calculator

Choose your course to see the practice sets that use this skill. You can also try practice mode or browse every GDC guide.

Quick questions

How do I fit an exponential or quadratic model on a calculator?

Enter the x-values in one list and the y-values in another, then run the regression for the model: ExpReg or QuadReg on the TI-84 Plus CE, CALC then REG then Exp or X squared on the Casio fx-CG50, a Calculate Summary Statistics regression on the fx-CG100, or Statistics then Stat Calculations on the TI-Nspire. The calculator gives the parameters of the equation.

Why does my TI-84 not show R squared?

R squared only appears when STAT DIAGNOSTICS is on. Turn it on in the mode screen, then run the regression again. The sinusoidal regression never shows it.

Which model should I choose?

Look at the scatter diagram and the context. Curves with turning points suggest quadratic or cubic, constant percentage change suggests exponential, a power relationship suggests power, and a repeating pattern suggests sinusoidal. Compare R squared for the candidates, but also check the model makes sense.

Why are my sinusoidal values different from the answer in the book?

A sinusoidal curve can be written in more than one equivalent form, and the calculator finds its answer by repeated approximation. Compare the graph of your equation with the data, and check the calculator is giving the angle in radians.