# TI-84 Data Fitting Tutorial Prepared for Math Link Participants By Tony Peressini and Rick Meyer Modified for TI-84 / TI-84 Plus by Tom Anderson, Feb.

## Presentation on theme: "TI-84 Data Fitting Tutorial Prepared for Math Link Participants By Tony Peressini and Rick Meyer Modified for TI-84 / TI-84 Plus by Tom Anderson, Feb."— Presentation transcript:

TI-84 Data Fitting Tutorial Prepared for Math Link Participants By Tony Peressini and Rick Meyer Modified for TI-84 / TI-84 Plus by Tom Anderson, Feb University of Illinois at Urbana-Champaign Copyright Board of Trustees, University of Illinois, 2006

TI-84 Data Fitting Tutorial—An Overview What should this tutorial help you do with your TI-84 or 84 Plus Calculator? After completing this tutorial, you will be able to: Enter, graph and manipulate data relating two variables Find linear, exponential, and power regression functions for your data—that is, find the linear, exponential or power function that best fits the data (in the sense of minimizing the sum of the squares of the vertical deviations of the function graphs from the data points). Determine how well a regression function fits the data points by statistical as well as graphical means. You will do all this in an interactive context involving some interesting real data on stomach and lung cancer.

An Illustrative Problem: Cancer Data
The best way to learn the data-fitting capabilities of the TI-84 is through a real problem using real data. The table below lists the number of deaths per year, per 100,000 women in the U. S. from lung cancer and stomach cancer during this century. Our task is to find the linear, exponential and power functions that best fit this data, and evaluate the "goodness of fit" for each of these functions. Year Lung Cancer Stomach Cancer 1930 2 28 1940 2.5 20.5 1950 5.1 14 1960 6 9 1970 10 5.5 1980 21 4.5 1990 30.5 3

In this tutorial, we will be making extensive use of the Statistics menu, (outlined in red on the keypad). To get to the Statistics menu, press the S key. (Do that now, and continue to use your calculator to follow along as you go through the tutorial.)

Clearing Previous Data
To clear any previously stored data, press the 4 key while in the Statistics menu. This will display ClrList on the Home Screen as shown in Figure 1. To clear lists L1, L2 and L3, complete the command to read ClrList L1, L2, L3 as shown in the first line of Figure 2, you need to enter the commas as well. Then press the e key. The TI-84 will respond with the message DONE . The lists L1 through L6 are referenced using the ` key (upper left on the keypad, outlined in red in combination) with the appropriate key 1–6 also outlined in red. For example: L4 is entered by typing ` 4 . Figure 1 Figure 2 Exercise 1: Clear lists L4, L5 and L6. Click here to see the Exercise 1 Answer

Making sure the TI-84’s STAT EDIT lists and Regression information haven’t been reprogrammed
List capabilities for the TI-84 are capable of being modified by the user. To insure that the STAT EDIT lists appear the same on your calculator as they do in the rest of this tutorial, do the following as a precautionary measure. Press S 5(SetUpEditor), e The screen will say SetUpEditor and DONE. These keystrokes clear out any user-defined lists which may have been in the STAT EDIT lists and would have altered the names for lists L1, L2, L3, L4, L5, and L6. To insure that information for LinReg, ExpReg and PwrReg, which we will use later, will match our screens, perform the following keystrokes. Press ` 0 (CATALOG), cursor down to DiagnosticOn and then Press e twice. The screen will say DiagnosticOn and DONE. These keystrokes cause the value of the correlation of coefficient, r, to be shown.

Entering Two-Variable Data
Return to the Statistics menu by pressing the S key. Then press the 1 key to edit the lists. Any previous values should have been cleared from the lists. The resulting screen is shown at the right. Use the arrow keys to enter the years in L1 and the lung death rate in L2. Leave the remaining lists empty for now. We will need them later.

Displaying Two-Variable Data on a Scatter Plot
Press the ` key, then the ! key (STAT PLOT) to get the STAT PLOTS menu shown at the right. Make sure that all plots are OFF. To turn the plots off, press the 4 key, followed by the e key. The TI-84 will respond with DONE. Press the ! key and clear any functions that may have been entered. This is accomplished by using the ARROW keys and the C key. At this point, everything that could have cluttered our data plot has been cleared or turned off. ( Continued on the next page…)

Displaying Two-Variable Data on a Scatter Plot
( Continued from the previous page…) Return to the STAT PLOT menu by pressing ` then ! . Press the 1 key to change the options for Plot 1. Use the ARROW keys and the e key to edit the screen so as to match the one shown at the upper right. Press # cursor down to 9:ZoomStat and them press e to display the data (or just press # 9 ) as shown in the screen to the right. NOTE: ZoomStat automatically sizes the GRAPH window to display the data in the lists chosen. Exercise 2: Enter the stomach cancer data into list L3, and display a plot of the data. Don’t forget to change the Ylist in the Plot 1 menu (above) to L3. Click here to see the Exercise 2 Answer

Finding the Linear Regression Line for the Lung Cancer Data
Return to the Statistics Menu (by pressing S), and highlight CALC by using the > key. Press the 4 key to show LinReg(ax+b) on the Home Screen. Complete to get LinReg(ax+b) L1,L2 and then press e to get the screen shown at the right. The values of a and b are the coefficients of the regression line y = a x + b for the lung cancer data. The value of r is the correlation coefficient—more about its meaning later! Exercise 3: Find the linear regression line for the stomach cancer data. Click here to see the Exercise 3 Answer

Displaying the Linear Regression Line for Stomach Cancer Data
Let’s see how well the regression line for stomach cancer from exercise 3 fits the stomach cancer data by plotting both on a single graph. STAT Plot 1 should already be set up to display the stomach cancer data which is in L3 because of exercise 2. You might wish to see, however, that STAT Plot 1 shows the Xlist as L1 and the Ylist as L3. You may also wish to rerun LinReg L1,L3 to make sure the linear regression equation for the stomach cancer data is your current function. Press ! . All the functions should be cleared. (If not, clear them now.) The blinking cursor should be at Y1. (If not, move it there.) Press v followed by 5 (Statistics). Use the > key to select EQ, then press 1 (RegEQ). This will copy the most recent regression data into an equation for Y1 ( top screen shot). Press # 9 (ZoomStat) to display the data and the graph of the linear regression equation (lower right screen). Exercise 4: Display the linear regression line with the data for the lung cancer data (list L2). Click here to see the Exercise 4 Answer

Brief comments on the "Goodness of Fit" of the Linear Regression Line
The stomach cancer data is again shown to the right with its linear regression line. The correlation coefficient (r) for this data was calculated along with the linear regression data to be: r =– In general, the closer the absolute value of r is to 1, the better the fit. In this case, the correlation coefficient does not rule out the possibility of a linear fit, but a look at the graph makes us think that we can get a better fit with some other type of regression.

Finding the Exponential Regression Curve for the Lung Cancer Data
Let’s have the TI-84 determine the exponential function y = a•bx that best fits the lung cancer data. Press the S key again, highlight CALC, and use the ; key to highlight 0: ExpReg] Press the e key once to show ExpReg on the Home Screen, complete ExpReg to show ExpReg L1,L2 as shown in the upper screen and then press e a second time to display the data for the exponential function that best fits the lung cancer data as shown in the bottom screen.

Displaying the Exponential Regression Curve for Lung Cancer Data
Make sure the TI-84 is set up to display the lung cancer data (list L2). (Review the "Displaying Two-Variable Data" pages if necessary.) Entering the exponential function into the Functions menu. Press the ! key. Clear out any functions in Y1 and leave the blinking cursor there. Press the v key, followed by the 5 (Statistics) key. Use the > key to select EQ, then press the 1k key (RegEQ). This will copy the most recent regression data (which should be the exponential regression data) into an equation for Y1 (upper right). Press the # 9 keys to display the data and the exponential regression curve (lower right).

Brief comments on the "Goodness of Fit" of the Exponential Regression Curve
The lung cancer data is again shown to the right with its exponential regression curve. This curve obviously fits the data quite well. The correlation coefficient (r) for this curve was calculated along with the exponential regression data: r = which is very close to 1. Exercise 5: Determine the exponential function that best fits the stomach cancer data, and display it along with the data. Click here to see the Exercise 5 Answer

Finding the Power Regression Curve for the Data
The procedures for computing the power regression function y = a•bx are nearly the same as for the exponential regression. Press the S key again, highlight CALC, and use the ; to highlight A: PwrReg. Press the e key once to show PwrReg on the Home Screen, complete PwrReg to show PwrReg L1,L2 and then press e a second time to display the data for the power function that best fits the lung cancer data (as shown above). Notice that the calculator gives an ERR:OVERFLOW message. What is going on? (Continued on the next page … )

Finding the Power Regression Curve for the Data (Continued from the Previous Page)
The problem in this case is that the data in list L1 (the "year data") is too large to accommodate a power fit. We can solve this problem by translating the year data to (year data – 1920) to get small, positive values in list L1. Press the S key, then the 1 key (Edit…). Use the ARROW keys to highlight the L1 at the top of the first list. Enter L1 – 1920, as shown at the upper right. (To get L1, press ` 1.) Then press e and you will get the screen shown in the middle. Recompute the PwrReg curve as explained on the previous page to get the screen shown at the lower right.

Displaying the Power Regression Curve
Plot the power regression curve with the lung cancer data using the same procedures as with the exponential regression. Make sure STAT PLOT 1 is set to display the correct lists, L1 and L2. (Keystrokes: ` ! 1. Set Xlist = L1 and Ylist = L2) . Enter the PwrReg curve into Y1. (Keystrokes: ! (clear Y1 if necessary) v 5 > > (to get EQ) 1 (RegEQ). Graph the curve and data points. (Keystrokes: # 9 (ZoomStat) Notice that the power fit is better than the linear fit, but not as good as the exponential fit. Exercise 6: Compute and plot the exponential fit for the new "year data" and compare the results with those obtained earlier. Click here to see the Exercise 6 Answer

Doing It All with Linear Regression A Better Approach for Algebra Classes?
The exponential and power functions that best fit the data in L1, L2 and L3 can be done using a linear regression because: If y is an exponential function of x, then log (y) is a linear function of x. Therefore, a linear fit to the lists L1 and log (L2) for the lung cancer data gives an exponential fit to the lists L1 and L2. If y is a power function of x, then log (y) is a linear function of log (x). Therefore, a linear fit to the lists log (L1) and log (L2) for the lung cancer data gives a power fit to the lists L1 and L2. This approach requires a transformation of lists and functions that may be more instructional for algebra classes. The details are presented in the following slides. Exercise 7: Start with y = a•bx and y = a•xb and derive the two results above. Click here to see the Exercise 7 Answer

Transforming Lists An Example Using Linear Regression for Power Regression
Press S 1 (Edit) to display the cancer data lists. Use the > : key to highlight the header L4 as shown to the right. Enter “Log L1" for list L4 by pressing the l key, then the ` key followed by the 1 key (L1). Press e . List L4 now contains the log of the corresponding entry in list L1. Exercise 8: Repeat the last three steps to enter the values Log (L2) into list L5. The resulting lists L4 and L5 are shown to the right.

Computing Power Regression from Linear Regression
Determine the linear regression line for list L4 and L5. (Press S select CALC, and press 4 (LinReg(ax+b)) to show LinReg(ax+b) on the home screen. Complete to show LinReg(ax+b) L4,L5 and then press e to get the screen at the right. The power fit y = c•xd of the data L1 and L2 is given by y = •x where c = 10b = d = a = Compare these values with the earlier fit of L1 and L2 to the right. (Note: a = c and b = d) We are right on! Exercise 9: Start with the LinReg(ax+b) L4,L5 equation and transform it by algebraic manipulations into y = a•xb form. Click here to see the Exercise 9 Answer

Computing Exponential Regression from Linear Regression
Determine the linear regression line for list L1 and L5. (Press S, select CALC, and press 4 (LinReg(ax+b)) to show LinReg(ax+b) on the home screen. Complete to show LinReg(ax+b) L1,L5 and then press e to get the screen at the right. For the exponential fit y = c•dx of the data L1 and L2, the base d and the coefficient c are given by: d = 10a = c = 10b = Compare these values with directly doing an exponential fit of L1 and L2, shown to the right. (Note a = c and b = d). We have the same base and same coefficient. Exercise 10: Start with the LinReg(ax+b) L1,L5 equation and transform it by algebraic manipulations into y = a•bx form. Click here to see the Exercise 10 Answer

TI-84 Data Fitting Tutorial Prepared for Math Link Participants By Tony Peressini and Rick Meyer Modified from the Fitting Data with the TI-82 or TI-83 Tutorial by Tom Anderson, Feb University of Illinois at Urbana-Champaign Copyright Board of Trustees, University of Illinois, 2001 The End Go back to the beginning of this tutorial Go back to the Math Teacher Link tutorial website

Exercise 1 Answer Use the following keystrokes:
Press S then 4 to get this first screen. Press ` 4 , ` 5 , ` 6 Press e to get this last screen. Click here to return to the tutorial

Exercise 2 Answer Use the following keystrokes:
Go to the STAT PLOTS screen by doing ` ! then choose 1 . Use the arrow keys to set Plot1 to On, and to use lists L1 and L3 (use ` 1 and ` 3 to set the Xlist and Ylist). Match the screen to the right, and then hit e to accept it. Press # 9 to get the plot. Click here to return to the tutorial

Exercise 3 Answer Use the following keystrokes:

Exercise 4 Answer Use the following keystrokes:
Go to the STAT PLOTS screen by doing ` ! then choose 1 . Use the arrow keys to set Plot1 to On and to use lists L1 and L2 (use ` 1 and ` 2 to set the Xlist and Ylist). Match the screen to the right, and then hit e to accept it. Press S , arrow over to CALC, press 4 (LinReg(ax+b)) ` 1 , ` 2 e to get the linear regression equation. (Continued…)

Exercise 4 Answer (Continued from the previous page…)
Press ! (then C if you need to clear out an existing equation from Y1) v 5 (Statistics), arrow over to EQ, press 1 (RegEq) to copy the linear regression equation into Y1. Press # 9 to get the plot. Click here to return to the tutorial

Exercise 5 Answer Use the following keystrokes:
Go to the STAT PLOTS screen by doing ` ! then choose 1 . Use the arrow keys to set Plot1 to On and to use lists L1 and L3 (use `1,`3 to set the Xlist and Ylist). Match the screen to the right, and then hit e to accept it. Get the regression equation by doing S arrow over to CALC, arrow down to 0:ExpReg, e ` 1 , ` 3 e . (Continued…)

Exercise 5 Answer (Continued from the previous page…)
Press ! then (C if you need to clear out an existing equation from Y1) v 5 (Statistics), arrow over to EQ, press 1 (RegEq) to copy the regression equation into Y1. Plot the data and the exponential regression equation in an appropriate window by doing # 9 (ZoomStat). Click here to return to the tutorial

Exercise 6 Answer Use the following keystrokes:
Go to the STAT PLOTS screen by doing ` ! then choose 1 . Use the arrow keys to set Plot1 to On and to use lists L1 and L3 (use `1,`3 to set the Xlist and Ylist). Match the screen to the right, and then hit e to accept it. Get the regression equation by doing S arrow over to CALC, arrow down to 0:ExpReg, e ` 1 , ` 3 e . (Continued…)

Exercise 6 Answer (Continued from the previous page…)
Press ! then (C if you need to clear out an existing equation from Y1) v 5 (Statistics), arrow over to EQ, press 1 (RegEq) to copy the regression equation into Y1. Plot the data and the exponential regression equation in an appropriate window by doing # 9 (ZoomStat). Click here to return to the tutorial

Exercise 7 Answer Exponential Function to linear form
Power Function to linear form y = a•bx y = a•xb log (y) = log (a•bx) log (y) = log (a•xb) log (y) = log (a) + log (bx) log (y) = log (a) + log (xb) log (y) = log (a) + x log (b) Since a, b are constants log (y) = log (a) + b log (x) Since a,b are constants log (y) = B + M x log (y) = B + M log (x) Therefore, log (y) is a linear function of x Therefore, log (y) is a linear function of log (x) Click here to return to the tutorial