TI-89
TechSkills 2: Regression

In this module we exploit the TI-89's statistical features to obtain a function that best describes a given data set from some point of view. The user must first decide on a kind of function to use, then the TI-89 finds an equation of best fit for that function. Once we have a function, then we can apply mathematical techniques for analysis.

The process of obtaining a function of best fit is called regression. The TI-89 supports a variety of functions for regression: linear, quadratic, cubic, quartic, power, exponential, logarithmic, sinusoidal, and logistic. We first illustrate with linear regression.

Linear Regression
Linear regression is the process of fitting a straight line to a data set. A linear function has the form y = ax + b. Hence, the task of linear regression is to determine values for a and b that create the straight line that best fits the given data. For example, we consider a data set from Sullivan and Sullivan, Precalculus enhanced with graphing utilities, Second Edition, page 112, Example 3.

Plot 1 2 3 4 5 6 7 8 9 10 11 12
fertilizer, X (lbs/100ft2) 0 0 5 5 10 10 15 15 20 20 25 25
Yield, Y (bushels) 4 6 10 7 12 10 15 17 18 21 23 22

First we enter the data points into a table in the TI-89. Then we conduct a linear regression to obtain the equation of the straight line of best fit through the three points. The slope of the regression line gives us a best estimate for the average rate of change of yield per pounds of fertilizer applied per 100 square feet.

Step 1: Data Entry
  • Turn the TI-89 on.gif and press the App.gif key. Press 6.gif to select option 6: Data/Matrix Editor. If this is the first time that you have used the Editor, choose the 3: New… option from the Editor submenu. You are then asked to identify the type of data that you are going to enter and to name the file. As in the picture, select Data as the Type:. Then use the thumb pad to navigate to the Variable: box and give the Variable a name (here, we entered crops). The Variable is like a file name that we are giving to the data set. Then press the Ent.gif key twice.

  • TS2FIG1.gif

    Note If you have used the Editor before, it may be more convenient simply to choose the 1: Current… option. Either way, you will end up in the Editor screen. The main difference is that by going through the 3: New option you get an empty data table. With the 1: Current option, the data table may have entries in it that need to be cleared. Clear the Editor by pressing f1.gif and then 8.gif Ent.gif to select 8downarrow.gifClear Editor.

  • In the Editor, use the thumb pad to highlight a cell for data entry. Accordingly, use the thumb pad arrow to highlight the cell in c1, row 1. Type 0 and press Ent.gif . The cell in c1, row 1 should display your data entry 0 and automatically highlight the next cell in c1. Enter the remaining data in c1 (type 0 Ent.gif 5 Ent.gif etc.). Now use the thumb pad to highlight row 1 in c2. Enter the data for c2 (4 Ent.gif 6 Ent.gif 10 Ent.gif etc).

  • TS2FIG2.gif

    Note If you want, you may name the columns. Use the thumb pad to highlight the cell above c1, then type X.gif Ent.gif . Highlight the cell above c2, then type Y.gif Ent.gif.

    After data entry, the next step is to plot the data set and then determine what type of function is appropriate for describing the data.

    Step 2: Plotting the Data Set
    To plot the data, you must tell the TI-89 where the data are that you would like to plot and what kind of plot that you want.

  • From the Editor window press f2.gif to access the Plot Setup menu. This menu displays 4 options at the top of the screen.
  • Select Define by pressing f1.gif . Choose Scatter as the plot type, select the marker of your choice, and enter c1 and c2 in the boxes for the x and y data respectively. To enter c1 in the x-box, type alp.gif RPar.gif 1.gif Ent.gif in the x-box. Navigate to the y-box using the down arrow key on the thumb pad (do not press the enter key to navigate between boxes). Then type alp.gif RPar.gif 2.gif Ent.gif in the y-box.
  • Press Ent.gif to return to the Plot Setup screen. You can toggle plots on and off using the f4.gif key (the check mark means that a plot is ON). Press Ent.gif again to return to the Data Editor screen. You are now ready to view a graphical representation of your data.
  • Press Dia.gif , then GRAPH (the display may not show your data in a satisfactory manner). Then use the handy ZoomData function by pressing f2.gif and 9.gif. Your data set is then nicely displayed in the viewing window.
  • TS2FIG3.gif

    TS2FIG4.gif

    TS2FIG5.gif

    Note If some unwanted graphs appear on the data set, go to the Y= menu and either deselect (use the f4.gif key) or clear the unwanted functions.

    Now look at the data set. Ask yourself, is it reasonable to describe this data set with a linear function? The linear function need not be a perfect fit to the data set, but should act as a general descriptor of the trend of the data in the viewing window. Here we notice the general upward trend of the data. It appears reasonable to draw a straight line through the data set that would act as a basic description of the general trend of the data.

    Note You can use the Trace feature ( f3.gif key) to trace the data points on your StatPlot. You may also adjust the tic marks by adjusting the WINDOW menu; for example, set xmin=-1, xmax=26, xscl=5, ymin=0, ymax=25, yscl=5, xres=1. After adjusting the window settings, then GRAPH.

    Step 3: The Calculations
    Now we fit a straight line through the data points. Of course, a straight line is uniquely determined by two points. Although our twelve points don't fit exactly on any straight line, the TI-89 has a built in feature called linear regression that determines the straight line that best fits our points. In statistics, this line of best fit is called a regression line.

  • From the Plot window, press App.gif 6.gif Ent.gif to select 1: Current and return to the Data Editor.
  • In the Data Editor, press f5.gif to access the Calc menu.
  • For Calculation Type, use the right arrow of the thumb pad to obtain the Calculation Type submenu. Highlight 5: LinReg, then press Ent.gif . Use the down arrow on the thumb pad to edit the
    x.............
    y.............
    entries. Tell the calculator which columns the x (input variable) and y (output variable) values are in. Here, the input values are in column c1 and the output values are in column c2. To enter c1 in the x-box, type alp.gif RPar.gif 1.gif Ent.gif in the x-box. Navigate to the y-box by pressing the down arrow key on the thumbpad (do not press the enter key to navigate between boxes). Then alp.gif RPar.gif 2.gif Ent.gif in the y-box.
  • Next, change the Store RegEQ to… to y1(x) by using the right arrow on the thumbpad. When done, your screen should look like this.
  • Press Ent.gif to perform the regression and to save the regression equation to y1(x). The regression results appear in the STAT VARS information box. Here, the regression equation is y=ax+b where the slope a = .717143 and the y-intercept b = 4.785714. Accordingly, we can report that the average rate of change of yield is .7 bushels per 100 pounds per square feet of fertilizer applied.
  • Press Ent.gif to return to the Data Editor.
  • TS2FIG6.gif

    TS2FIG7.gif

    Step 4: Plotting the Data with the Regression Curve
    We now obtain a plot of the data set with the regression line superimposed on the data. Since the plot setup is already done, we merely need to ask for the graph.

  • Press Dia.gif , then GRAPH. Your data set is beautifully displayed on the screen with the regression line running through it. Very nice!

    Note You can use the Trace feature to trace either the data points or the regression line. Press the f3.gif key to access Trace. Use the left-right thumb pad keys to move along the data set. Use the up (or down) key to transfer to the regression line. Then, the left-right thumb pad keys will navigate along the regression line. Use the up (or down) key to return to the data set.

  • Nonlinear Regression
    To illustrate obtaining a function from data, we utilize a data set for the growth of the brewers' yeast, Saccharomyces cerevisiae, obtained by the Swedish biologist Tor Carlson in 1913. Here, time is measured in hours and population in biomass units.

    table1.gif First enter the data set. Press App.gif 6.gif Ent.gif , then select either 1:Current or 3:New to return to the spreadsheet. If you select 1:Current, you will need to clear the old data. To clear the old data in column c1, first use the arrow keys to highlight the column heading c1. Then press 2nd.gif f1.gif to access F6 Util, the utilities menu. Then select 5:Clear Column. Then use the arrow keys to highlight the column heading c2. Then press F6 Util again, and again select 5:Clear Column. After the old data set is cleared, then enter the new data set.


    TS2FIG8.gif After the data are entered and checked, then we are ready to view the scatter plot. Press Dia.gif, then GRAPH (the display may not show your data in a satisfactory manner). First, go to the Y= menu and clear or deselect any unwanted functions. Then, use the handy ZoomData function by pressing F2 to access the Zoom menu, then press 9.gif to select 9:ZoomData. Your data set is then nicely displayed in the viewing window. Although the data points are plotted, we can adjust the window for better viewing. First go to the Y= menu and clear the previous regression equation. Then adjust the WINDOW with settings appropriate for the yeast data; for example: xmin=-1, xmax=8, xscl=1, ymin=0, ymax=300, yscl=100, xres=1. Finally, press Dia.gif, then GRAPH.


    Step 3: The Calculations
    We are now ready to fit a function to the data. For this we must first decide on a function whose graph looks like a good descriptor for the data. From merely looking at the data and mentally overlaying a smooth curve through the points, we envision a curve that is increasing and describing growth, suggesting an exponential function. No calculator or computer can make this decision. You must make this decision using your knowledge of mathematics and the science of the background reality. For the TI-89, the general exponential function is y=abx. Using exponential regression, the TI-89 will determine the values for a and b that provide a general exponential function of best fit based on the given data.

  • From the Plot window, press App.gif 6.gif Ent.gif to return to the current Data Editor.
  • In the Data Editor, press f5.gif to access the Calc menu.
  • For Calculation Type, use the thumb pad to select the type of regression that you think will best fit the data. In our example, select 4:ExpReg (press 4.gif Ent.gif ). Use the down arrow on the thumb pad to edit the x….. and y….. entries. Tell the calculator which columns the x and y values are in by typing alp.gif RPar.gif 1.gif Ent.gif to enter c1 in the x-box and alp.gif RPar.gif 2.gif Ent.gif to enter c2 in the y-box.
  • Next, change the Store RegEQ to… to y1(x) using the thumb pad. When done, your screen will look something like this.
  • Press Ent.gif to perform the regression and save the regression equation to y1(x). An information box containing the regression results appears. Our exponential function of best fit is y=abx where a=10.975695 and b=1.589837.
  • Press Ent.gif to go back to the Editor.
  • TS2FIG9.gif

    TS2FIG10.gif

    Step 4: Plotting the Data and Regression Curve
    Since the plot setup has already been done in viewing the data set, we are ready to graph.

    TS2FIG11.gif

  • Press Dia.gif GRAPH. Your data should be beautifully displayed on the screen with the regression curve running through it. Now that's really awesome!

    Note You can use the Trace feature to trace either the data points or the exponential curve on your StatPlot.


    Logistic Regression
    One does logistic regression by following the directions given in Nonlinear Regression. However, the equation returned by the TI-89 for logistic regression is not the basic logistic equation. The general form of the basic logistic equation is

    math_eq3.gif

    where K is the carrying capacity and r is the intrinsic growth rate. However, the TI-89 returns the logistic with a vertical translation in the form

    math_eq4.gif

    Accordingly, the initial population, f (0), and carrying capacity, K, are calculated by

    math_eq5.gif and K = math_eq6.gif .

    We conclude with an additional step for students in calculus.

    A Tangent Line
    Your TI-89 can draw a tangent line to a function at a specified point. The slope of the tangent line is our desired estimate for the instantaneous rate of growth; say, at t=4. Here is how it works. We suppose that the screen is showing a plot of the data and a graph of the exponential regression curve.

  • From the graph screen press f5.gif to access the Math menu, then select A:Tangent. Blinking crosshairs will appear on the regression curve. Simply type in 4.gif and then press Ent.gif . Alternatively, you may use the thumb pad to position the trace crosshairs as near as possible to the desired point of interest.

    Soon the tangent line will be drawn and its equation displayed at the bottom of the screen. Did you get a slope of 32.5? We conclude, the yeast population is increasing at the rate of about 32 biomass units per hour after four hours of growth. Recall that the conclusion to any applied problem should always be stated as a complete sentence with numbers described within the context of the given problem. TS2FIG11.gif

    Suppose now that you would like to estimate the slope of the tangent line at another input value. If you want to leave the old tangent line for comparison, proceed with the above instructions for obtaining the tangent line at a new input value. If you'd like to clear the current tangent line, then select F6, then press 1.gif to select the 1:ClrDraw option to clear the drawing. Enjoy!

    END


    The author wishes to extend his appreciation to Texas Instruments for their professor assistance program. Visit the TI calculator website at http://www.ti.com/.

    Charles M. Biles, Ph.D.
    Department of Mathematics
    Humboldt State University
    Arcata, CA 95521-8299