## Fitting Formulas to Data: TI89

• The TI89 offers the following options for curve fitting:

Description Command Formula
Cubic regression CubicReg y = a x3 + b x2 + c x + d
Exponential regression ExpReg y = a bx
Linear regression LinReg y = a + b x
Logarithmic regression LnReg y = a + b ln(x)
Median-median fit MedMed y = a + b x
Power regression PowerReg y = a xb
Quadratic regression QuadReg y = a x2 + b x + c
Quartic regression QuartReg y = a x4 + b x3 + c x2 + d x + e
Sinusoidal regression SinReg y = a sin(b x + c) + d
Logistic regression Logistic y = a (1 + b ec x)-1 + d

• The steps for fitting a regression curve to a collection of data points are as follows:

1. Enter the data

2. View a scatter plot

3. Obtain an appropriate regression equation

4. Plot the regression equation along with the scatter plot

• Example 1:  Our first example will be represented by the following table:

a 3 4 5 6
S 105 117 141 152

We wish to find a curve that best fits this set of points.

1. Enter the data

The calculator stores data in lists.  We will use the lists specified c1 and c2.  The steps are:

1. Create and name the lists:

To create lists, we will have to first specify a name for them.  Press [APPS], and then press [6] for the Data/Matrix Editor option.  A small menu will appear.  For a new set of lists for our data, press [3] for the New... option.

1. In this new screen, make sure that the Type: specification is set to Data.  If not, move the cursor to the Type: designation, and press the right-cursor key.  A small menu will appear, from which you select [1] for the Data option.

2. Now move the cursor down to the Variable: box and type in a name for your data.  The name must be something for which the calculator does not already have a designated function.

Once this is complete, press [ENTER].

2. You should now be in the data entry screen.  The cursor will be in the first row of the c1 column.  From the bottom of the screen, below the lists, enter each data item from the line of the table that corresponds to the values of a, followed by [ENTER].

Next move the cursor into the first row of the c2 column and repeat for each element in the line of the table that corresponds to the values of S.

When the data have been entered, [QUIT] the screen (which is [2nd][ESC]).

2. View a scatter plot:

1. Any undesired functions entered on the y1=, y2=, ... lines of the [Y=] screen will have to be cleared out.  To do this, go to [Y=] (which is the green diamond key, [¤], followed by [F1]), move the cursor to each appropriate line, and press [CLEAR].

2. Make sure that Plot1 is On.  We can do this from the [Y=] screen.  If there is a small check-mark to the left of Plot1:, then it is On.  Otherwise it is Off.  To turn Plot1 On or Off, move the cursor to the Plot1: position and press [F4].  This will change the On/Off designation of Plot1:, and the small check-mark will either appear or disappear.

3. We now need to specify the parameters that define Plot1.

We change the type of points that Plot1 is designated to produce from the [Y=] screen.  Move the cursor to the Plot1: loction.  From here, press [F3], which is the editor for Plot1.

1. In this new screen, we need Plot Type to be specified as Scatter.  If this is not the case, then move the cursor to the Plot Type line, press the right-cursor key, and select [1] from the small menu that will appear.

2. To set the point designation for the scatter plot, move the cursor to the Mark line. From here press the right-cursor key, and select the type of point desired from the small menu that will appear.  The selection 1:Box should work nicely.

3. Now move the cursor down to the x box and type c1 (which is [alpha][)][1]) into this space.  This indicates that the x-values of the points are to be taken from list c1.

4. Next, move the cursor down to the y box and type c2 into this space.

Once these have been specified, press [ENTER].  This will take us back to the [Y=] screen.

4. We can now generate a scatter plot.  From the [Y=] screen, press [F2], which is Zoom.  A small menu will appear.  From here press [9] for the ZoomData option.  A scatter plot of the data will then appear.  The points will appear as whatever is designated by Plot1.

The x- and y-dimensions of the screen window will be set automatically.  Look at the window settings (press WINDOW, which is [¤][F2]) to see which parameters were chosen.

3. Obtain an appropriate regression equation:

1. The scatter plot suggests that the relationship between measurements a and S is approximately linear, so we will choose a linear regression.

2. To obtain the regression line, press [APPS], and then press [6] for the Data/Martix Editor option.  We want the same data screen that we had earlier, so select [1] for Current.

We are now back in the previous data entry screen.  Press [F5], titled Calc, and a new screen will appear.  With this screen we will specify the parameters for our calculation.

1. Move the cursor to the Calculation Type designation.  If it is not set on LinReg, then press the right-cursor key.  A small menu will appear, from which you select [5] for the LinReg option.

2. Now move the cursor down to the x box and type in c1.  This specifies that the x-values of our data points will correspond to the values in list c1.

3. Next move the cursor down to the y box and type in c2.  This specifies that the y-values of our data points will correspond to the values in list c2.

4. Move the cursor down once more to the Store RegEQ to line.  Press the right-cursor key, and on the small menu that will appear, move the cursor to the y1(x) option and press Enter.  The resulting regression equation will then appear on the y1= line of the [Y=] screen.

At this point, our calculation specifications have been made, and so press [ENTER] to make the calculations and to exit this screen.

A new screen will appear, yielding the values a=16.5 and b=54.5 for the equation y=a·x+b, so that our regression equation is

y = 16.5 x + 54.5.

The correlation coefficient, corr=.988627, indicates how well the regression curve fits the data.  A correlation that is close to 1 is good.  Press [ENTER] to get back to the data entry screen.

4. Plot the regression equation along with the scatter plot:

Press [Y=], and the regression equation should be on the y1= line.  Select option [F2], titled Zoom, and then press [9] for the ZoomData option.  The graph will appear on the screen, along with the scatter plot.

• Example 2:  Here we use the data from Problem 4 on page 5, which gives the profit (in millions of dollars) for The Gap, Inc. for the years from 1990 to 1997.

Year (since 1990) 0 1 2 3 4 5 6
Sales (\$ million) 144.5 229.9 210.7 258.4 350.2 354.0 452.9

Once again, we wish to find a curve that best represents the relationship between the two variables.

1. Enter the data as we did earlier.  We can either create a new list of data, or modify the previous one.

2. View the corresponding scatter plot.

The scatter plot looks fairly linear, but, since this is financial data, we want a growth rate, so we will look for an exponential model.

3. Follow the same steps to obtain the regression equation, but this time choose ExpReg (which is [4]), under the Calculation Type option in Calc of the data entry screen.

This yields the values a=160.783898 and b=1.186938 for the equation y=a·b^x, so that our regression equation is approximately

y = 160.8 (1.187)x.

The correlation coefficient is not given.

4. Recall that our model is

P = P0 (1 + r)t.

We have found the growth factor 1 + r to be approximately 1.187.  This means that the growth rate r = 0.187.  We can conclude that the profits for The Gap, Inc. were growing at 18.7% for this time period.

5. Follow the same steps that we had with the previous problem to view the exponential graph with the scatter plot.