Math 160 - Cooley TI Calculator Handout #9 OCC

Linear Regression on the TI–84+

Linear regression is an approach for modeling the relationship between a dependent variable y and an explanatory variable denoted x. In linear regression, data are modeled using linear predictor functions, and unknown model parameters are estimated from the data. If the goal is prediction, or forecasting, or reduction, linear regression can be used to fit a predictive model to an observed data set of y and x values. After developing such a model, if an additional value of x is then given without its accompanying value of y, the fitted model (best-fit) can be used to make a prediction of the value

of y.

The TI–84+ can calculate the regression equation as well as the correlation coefficient. The correlation coefficient, defined as r, is a measure of the strength and direction of the linear relationship between two variables that is defined as the (sample) covariance of the variables divided by the product of their (sample) standard deviations.

Example #1: Consider the data, (10, 12) , (11, 15) , (12, 14) , (13, 16) , (14, 18).

a) Determine the equation of the regression line.

b) Find the correlation coefficient and describe the type of correlation, (i.e., positive, negative, as well

as strong, moderately strong, or weak or none) between the x and y values for the data above. Also,

explain your reasoning.

c) Graph the scatterplot and the regression equation on the same set of axes.

Solution
#1 / In order to answer all three parts, we must first enter the data in two separate lists.
All versions of TI-83+ & TI-84+
Part 1: Entering The Data As Lists
·  The data must be stored in the calculator as two separate lists, before any calculations can be made.
▒ Key in: STAT. Scroll to EDIT. Select Edit ENTER.
At this point you should see three columns labeled L1, L2, and L3. If there are data present you must clear all the
entries. To do so you can simply cursor over the unwanted entries and press DEL each time. However, if you would like to delete the entire list cursor over the list name (L1) at the top and press CLEAR ENTER . Do not press the DEL button! In the event that L1 and L2 were deleted or were simply not present, you must position the cursor across the top and key them in by pressing 2ND L1 and 2ND L2, respectively. If L1 and L2 are not displayed, then the calculator will not be able to perform any scatterplot or regression line.

Now, let’s enter the data. Enter the x-coordinates in column L1
and the y-coordinates in column L2.
▒ Key in the x-coordinates in column L1 : 10 , 11 , 12 , 13 , 14
▒ Key in the y-coordinates in column L2 : 12 , 15 , 14 , 16 , 18
Part 2: Finding The Equation Of The Regression Line
·  Once the data is stored in the calculator, we can find the linear regression line, also called the line of best fit.
TI-83+, TI-84+ (2.53MP and earlier) / TI-84+ (2.55MP)
▒ Key in: STAT. Scroll to CALC. Select
LinReg(ax+b) ENTER ENTER.

/ ▒ Key in: STAT. Scroll to CALC. Select
LinReg(ax+b) ENTER ENTER.
A new screen will come up. Make sure that XList has the entry L1 and YList has the entry L2. If so, scroll down (or ENTER ) to Calculate.

When your cursor is on Calculate, press ENTER.
Solution a) The result will be displayed on the calculator. The equation y = ax + b is shown along with the
coefficients a and b. Since a = 1.3 and b = -0.6, and a and b are defined by: y = ax + b, the equation
of the regression line is y = 1.3x + -0.6 or y = 1.3x – 0.6.
Part 3: Finding The Correlation Coefficient, r
From the LinReg(ax+b) function, you should be able to find the correlation coefficient. However, sometimes you might not see the last two lines which are supposed to be r2 and r. In order to display this option, the calculator’s Diagnostics must be turned on.
TI-83+, TI-84+ (2.53MP and earlier) / TI-84+ (2.55MP)
▒ Key in: 2ND CATALOG.
You can cursor all the way down to the DiagnosticsOn option, however, that will take a while. To access it more quickly, simply press D. This will automatically jump the cursor down to the index of all words/commands/functions that will begin with the letter D. You do not need to press ALPHA when doing this because once you are in the catalog menu, the alpha function is already activated. Cursor down to DiagnosticsOn and press ENTER ENTER. (The catalog menu is where you can find everything in the event you forgot how to access a particular command or function. Unfortunately, this is the only way to call up the Diagnostics option.)

Once you have the Diagnostics turned on, repeat Part 2 again and you should now see r2 and r.
/ ▒ Key in: MODE and cursor up to
STAT DIAGNOSTICS
Cursor over to ON and press ENTER.

Once you have the Diagnostics turned on, repeat Part 2 again and you should now see r2 and r.

The last two lines displayed, r2 and r, are used to describe the strength of the correlation between the data. The r2 is called the coefficient of determination. The r is the correlation coefficient, which is what we want. Recall, when
| r | is close to 1, we say that there is a strong positive (or negative) linear correlation among the data. The positive or negative phrasing refers to the sign of the slope, a, of the linear regression line. When r is close to 0, we say that there is no linear correlation. Basically, the more linear the plot looks, then the stronger the linear relationship between the data. Below is a scale describing the correlation coefficient, r:

Solution b) So, the correlation coefficient, r is .919. Thus, there is a strong, positive linear correlation among the
data.
All versions of TI-83+ & TI-84+
Part 4: Turning On Stat Plot
·  After the data is stored in the calculator, we must set up our Stat Plot options in order to display a scatterplot.
▒ Key in: 2ND STAT PLOT.
1) There are 4 different categories for Stat Plot options. We will simply use the first one. The cursor should
already be on STAT PLOTS and 1:Plot1..., so just press ENTER.
2) On this menu, there are six different attributes that must be set:
a) The top line should read Plot1 Plot2 Plot3. Make sure that Plot1 is highlighted. If Plot1 is not highlighted, cursor over to Plot 1 and press ENTER.
b) The second line reads On Off. This is where we tell the calculator to turn on the Stat Plot for Plot1. Make sure that On is highlighted. Cursor over and press ENTER to highlight the On option.
c) Cursor down one line. The cursor should already be located on the first graphic of the line for the
Type: option. The first graphic is the scatterplot feature. Press ENTER.
d) Cursor down one line to the Xlist: option and make sure it reads L1. If it does not, press 2ND L1.
e) Cursor down one line to the Ylist: option and make sure it reads L2. If it does not, press 2ND L2.
f) Cursor down one line to the Mark: option.
This is where you can choose 3 different types of displays for the actual points plotted on the
scatterplot. Just select the first one which should already be highlighted.
See the figure below to verify the above settings. Keep in mind, once all of these options have been selected, you need not to go back each time and repeat the above process. However, it is always a good idea just to make sure that all the options stay the same.

Part 5: Displaying The Scatterplot
·  When Parts 1 through 4 are completed, we can finally graph/display a scatterplot.
▒ Key in: GRAPH. More than likely, nothing will be displayed. So, now, press ZOOM then go to 9:ZoomStat.
The scatterplot will now be displayed in the window.

All versions of TI-83+ & TI-84+
Part 6: Graphing The Regression Line
·  When Parts 1 through 4 are completed, we can graph the regression line while displaying the scatterplot.
Method 1 - Type in the equation directly - One way to graph the regression line is to press the Y= button and directly type the equation obtained from Part 2. Then, press GRAPH.
Method 2 - Paste the equation – If you choose to paste the equation, first make sure that you have completed Part 2 from above. The calculator is programmed to hold in memory the equation of the last linear regression line that was calculated.
▒ Key in: Y =. Clear/delete any previous equations.
▒ Key in: VARS then go to 5:Statistics. A new menu will appear.
▒ Key in: Cursor across to EQ then go to 1:RegEQ. The equation that was obtained from Part 2, has now been
pasted in the Y = menu.
▒ Key in: GRAPH. The regression line will be graphed with the scatterplot on the same set of axes.
Solution c)

- 1 -