Introduction to Correlation and Linear Regression

Using the TI-83/84 Graphing Calculator

Dr. John C. Nardo††††††††††††††††††††††††††††††††††††††††††††††††††††
Division of Mathematics & Computer Science†††††††††††††††††††
Oglethorpe University††††††††††††††††††††††††††††††††††††††††††††††    
Atlanta, GA 30319††††
(404) 364-8327††††††††††††††††††††††††††††††††††††††††††††††††     


In order to get full information during linear regression analysis, the diagnostics for the TI-83 calculator must be on. Access the DiagnosticOn command through the catalog.† Access the catalog: [2nd] [0]. To move to the commands which begin with the letter D, scroll down to the command using the down arrow or type the key for the letter D [ ]. When the DiagnosticOn command is selected with the character, hit [ENTER] to bring the command to the home screen. Hit [ENTER] again to execute the command. The calculator should now display "Done."

The diagnostics will remain on until they are turned off or something catastrophic (like a battery failure/change) occurs.

Entering the Data

First, we must enter the data sets using the Stat Editor. Press [STAT]. The Edit command should be selected, i.e. its label 1 should be highlighted.

Use the up and down arrows to move among the other commands, if needed. To execute the Edit command, press [ENTER]. You should now have a worksheet consisting of six columns labeled L1 through L6. Each column is a separate data set/list.

Use the left and right arrows to move to a column/list which is blank. Type each piece of data and hit [ENTER]. Continue until all data has been entered into the calculator.† If you make a mistake before you press [ENTER], you may use the left and right arrows to move in the entry and retype to correct the error. If you do not realize your error until after you have pressed [ENTER], use the up and down keys to reselect/highlight the mistaken entry and retype. If you want to erase an entry entirely, use the up and down keys to reselect/highlight the entry and hit the delete key [DEL].

The Main Example

Professor Hamid Zangenehzadeh collected data from thirty-nine business professors at Widener University. The data below chronicles each professorís average rating and the average grade students expect to earn in that professorís class. All data is given on a four point G.P.A. scale.

Enter the professorsí ratings in L1 and the studentsí expected grades in L2.

For more information, see Hamid Zangenehzadehís article "Grade Inflation: A Way Out" (Journal of Economic Education, Summer 1988, pp. 218-226) or the second edition of Prem Mannís book Introductory Statistics (John Wiley & Sons, Inc., 1995, pp. 703-704).

Teachersí Ratings

Studentsí Expected Grades















































































Creating Scatterplots

We may create a graphical representation of a pair of data sets by using the calculator to generate a scatterplot. Access the STAT PLOT screen by pressing [2nd] [Y=]. There are three separate plots which you may use: Plot1, Plot2, and Plot3. You may choose to always reuse the same plot or to switch back and forth between plots.

Choose a plot by using the up and down arrows to select/highlight the plot. Press [ENTER] to carry out this choice. The cursor should be blinking on the word On. Press [ENTER] to turn the plot on; the word On should now be selected/highlighted.

Move to the next selection/choice by pressing the down arrow. There are six icons denoting the various types of statistical plots available on the TI-83. The icons represent scatterplots, line graphs, histograms, modified boxplots, boxplots, and normal quantile plots, respectively. The left and right arrows move between these choice. Make sure that the cursor is blinking over the top left icon and hit [ENTER] to select the scatterplot option.

Press the down arrow to move to the next selection. Now, we must choose which data is graphed on the horizontal axis and which is graphed on the vertical axis. The professorsí rankings are in the list L1 and should be selected as the Xlist. Press [2nd] [1]. Press the down arrow to move to the Ylist choice. The studentsí expected grades, L2, should be selected: press [2nd] [2].

Finally, to decide with which label to mark points on the scatterplot, press the down arrow. The left and right arrows move between the three style choices. Press [ENTER] to select your choice.

We will use the ZOOM menu to generate the scatterplot. Press [ZOOM]. Press the up arrow twice to select/ highlight ZoomStat. Press [ENTER] to execute this command. (As a shortcut you may simply press [9] to select and execute this command simultaneously.) The TI-83 calculator will now choose appropriate ranges of values for the variables, automatically set the "best" viewing window, and generate the scatterplot.

If you are interested in the values chosen for the horizontal and vertical axes, press [WINDOW]. The entries Xmin, Xmax, Ymin, and Ymax are self-explanatory. The entries Xscl and Yscl indicate in what increments tick marks are placed on the axes. Usually, we leave these set to 1 in order to have tick marks at every integer. We may ignore the entry Xres and leave it set to 1.

To regenerate the graph, press [GRAPH]. If you wish to stop your current action and return to the home screen, then execute a quit by pressing [2nd] [MODE].

Calculating the Correlation Coefficient and the Equation of the Least Squares Line

We may calculate the correlation coefficient, its square, and the equation of the least squares line all in one fell swoop. Press [STAT] and then press the right arrow to access the calculation (or CALC) menu. Press the down arrow until the fourth command LinReg(ax + b) is selected/highlighted. Press [ENTER]. (As a shortcut, you may simply type [4] after accessing the CALC menu.)

The LinReg(ax + b) command requires three arguments: the list holding the data which is graphed on the horizontal axis (here L1), the list holding the data which is graphed on the vertical axis (here L2), and the variable in which you wish to store the equation of the least squares line (here Y1).

Once you have the LinReg(ax + b) command on the home screen, type the following sequence of keystrokes to enter the three arguments:

[2nd] [1]
[2nd] [2] [,]
[VARS] [right arrow] [ENTER] [ENTER].

Your screen should look like the following:

Hit [ENTER] once more to execute the linear regression and correlation analysis. Your screen should now look like the following:

The slope and y-intercept of the least squares regression line are displayed along with the correlation coefficient and its square.

Graphing the Least Squares Line and the Scatterplot Simultaneously

When the third argument Y1 is used in the LinReg(ax + b) command, the calculator automatically stores the equation of the least squares line as equation Y1. To verify this, access the regular graphing menu by pressing [Y=].

To display the scatterplot and the least squares line simultaneously, press [GRAPH] or [ZOOM] [9].

Prediction via a Function Approach

The reason for constructing a least squares line is to make predictions. Given an x, a value for the variable on the horizontal axis, we may substitute into the least squares equation to yield a y, the predicted value for the variable on the vertical axis. We may interpret y as a function x and use appropriate notation to generate these predicted values.

Example: Predict the y-value associated with x = 3.25. To enter Y1(3.25) in the home screen, type [VARS] [right arrow] [ENTER] [ENTER] [( ] [3] [.] [2] [5] [ )]. This should yield approximately 3.248.

Shortcut: If you wish to calculate another predicted function value, then you may save time by pressing [2nd] [ENTER]. This creates a copy of your previous command on the home screen. Use the left and right arrow keys to edit the command and then press [ENTER] to execute the modified command.

Note: Any real number may be used as a value of x via this function approach.

Prediction via a Graphing Approach

If the scatterplot and least squares line are displayed simultaneously on a graph, then you may use the calculatorís Trace feature to make predictions. Make sure that the graph is displayed. Press [TRACE]. Press the down arrow. The equation of the least squares line should be in the upper left-hand corner. (If not, then continue to press the down arrow until it is.)

Example: To predict the y-value associated with x = 3.25, simply type 3.25! Note that you get the same answer as above.

Note: Only real numbers in the viewing window may be used as values for x via this graphing approach.

If the x-value you desire to use is not in the viewing window, then the calculator will give an error message. Press [ENTER] to exit the error message. Now, you must modify the viewing window to allow your value of x. Press [WINDOW]. Choose new values of Xmin and Xmax which include the desired value of x. Press [GRAPH] [TRACE] [down arrow]. Type in the desired value of x again.

Residual Plots

Every time that a linear regression is performed, the TI-83 automatically generates a list of the residuals, or predictive errors, associated with the least squares line. This list is named RESID. To verify its existence, access the LIST menu by pressing [2nd] [STAT]. Use the up and down arrows to select/highlight the list RESID. Press [ENTER] to bring the list to the home screen. Moving via the left and right arrows scrolls through the list of residuals.

We may construct a residual plot using the STAT PLOT menu. Create a scatterplot in which the Xlist is the list of data for the horizontal axis (here L1) and the Ylist is RESID. Type the word RESID using the calculator keys which have those letters in green. Notice that the cursor is now a blinking A to let you know that the calculator keys will be interpreted as letters.

The residual plot indicates how well the least squares line fits the data. This information, along with the original scatterplot and the correlation coefficient, may be used to decide the appropriateness of a linear model for the data and thus the validity of predictions made from such a linear model.

The residual plot should look like the following: