For both correlation and regression we assume that we are dealing with data that is given as pairs of values, an X value and a corresponding Y value. The table below identifies such pairs of data, and it gives an index value to each pair. With the assigned index value we can talk about the fifth pair and see that the fifth pair is X=29 and Y=50. The following table gives the pairs of values that we will use for this page.
![]() | We start the GNRND4 program and use the key values shown in Figure 1. One thing to note here is that based on the values in the first key, the program determines that it requires two additional key values. This difference is continued in Figure 2 where the displayed output consistes of not one but two lists. |
![]() |
GNRND4 displays the first list and pauses to allow the user to scroll
across the items of that list. The user
presses ![]() |
![]() |
We can plot these pairs of values. We use a coordinate axes system
to do this. On the calculator this is called a scatter plot.
We press ![]() ![]() ![]() |
![]() |
Here is the Plot1 screen before we have changed it.
We will move the highlight to the scatter plot icon,
![]() ![]() ![]() |
![]() |
Figure 5 shows the changed settings. We note that we did not have to changes the Xlist: setting because our X values are in L1. Likewise, we did not have to changes the Ylist: setting because our Y values are in L2. Now that Plot1 is set, we move to set up the window for the plot. |
![]() |
Press ![]() ![]() ![]() |
![]() |
Here is a plot of the X,Y pairs of values. In this
case these pairs of values have a strong linear relation.
We can see this because the plotted points seem to fall
on a straight line. The two questions before us are
|
![]() |
Looking ahead, we want to be sure that the calculator being used here
has Diagnostics turned ON. Once this has been turned ON
for a particualr calculator, it is supposede to stay ON. Therefore, this
should be a task that only needs to be done once. Still, it is nice to know how to do it
just in case it needs to be done again. If you are sure that your calculator has Diagnostics
turned On, then skip to Figure 11. Otherwise follow the steps here.
We find the command DiagnosticOn in the CATALOG.
We open the CATALOG by pressing
|
![]() |
We can scroll down to the command. There is a slight help in doing this.
If we press ![]() Once the command is highlighted, press
|
![]() |
Once the command is pasted to the main screen
we press ![]() |
![]() |
Use ![]() ![]() ![]() Press |
![]() |
We now have the right command in place. Given in this fashion,
the LinReg(ax+b) command will cause the calculator to compute,
from the data in L1 and
L2, the coefficient (a)
and the constant (b) in the
y =ax+b form of the linear equaton that
best fits the data in those lists.
We press ![]() |
![]() |
The result is shown in Figure 13. Here the calculator reminds us that the
form of the linear regression equation is y=ax+b. Then the
calculator tells us that the line of best fit will have
a=1.490358348 and b=7.723043548.
If we were to round these two values to the nearest hundredth, then
the linear regression equation could be written as
Correlation coefficients range from +1 to –1, with high degrees correlation (i.e., having the plotted points be really close to a straight line) being close to +1 and –1. Situations where the plotted points are more spread out, not falling so close to a line, have correlation coefficients closer to zero. We will see this situation on a different web page. |
At this point we know the linear regression equation. It would be nice to actually see it on the graph. Fortunately, it is not a huge problem to get the calculator to do this.
One of the primary uses of getting the linear regression equation is to be able to use it, not just graph it. By "use it" we mean that if we are given a value for X then we can put that value into the equation and calculate the expected value of Y. As is usually the case there are many different ways to get the calculator to help us do this. For example, if we were given the value 20 for X then, using the rounded version of the linear regression equation given above, we could type
We could do this same thing with the value 27, calculating
Having two values, an observed and an expected value allows us to form a new value called the residual. We define the residual as
Let us return to the calcualtor to see how to do some of these same things.
![]() |
The first task is to get the calculator to draw
the linear regression equation.
To do this we open the Y= window via
![]() |
![]() |
We use ![]() ![]() |
![]() |
THis takes us to the VARS Statistics sub-menu. Here we have all sorts of statistics variables that we can recall. However, we want an equation. TO get that we move to the right two times to get tot eh EQ, or equation, sub-menu. |
![]() |
The first item in this sub-menu is RegEQ, our regression equation.
We press ![]() |
![]() |
Here we see that the calculator has pasted the entire original regression equation
onto this screen. A closer examination of that equation shows that the calculator actually pasted a
14-digit version of the equation here, not the shorter 10-digit values given in Figure 13.
Once the equation is here we can press |
![]() |
Now, in addition to the plotted points we have the graph of the linear regression line. |
![]() |
For Figure 20 we have moved into TRACE mode by pressing
the ![]() At the bottom of the screen the X=13 and Y=29 indicate
the coordinates of the highlighted point.
The highlighted point is a bit hard to see here, but it is the point
below the arrow in |
![]() |
Pressing the ![]() |
![]() |
Pressing the ![]() |
![]() |
Pressing the ![]() |
![]() |
Now, because we are tracing the graph of the line, when we
press the ![]() ![]() We could use this feature to find expected values, but it is a pain to keep moving left and right in such small increments. Also, the choice of X values is a calculator decision. Thus, we can get close to an X value of 24 but we are not going to be right at 24 by moving the highlight left and right like this. |
![]() |
However, when we re in TRACE mode, as we are in Figure 24, we can just type in the
desired value of X. Figure 25 is the result o
pressing ![]() ![]() ![]() |
![]() |
Now the trace is at the point X=20 and Y=37.530211, the expected value. We might recall that when we used the rounded linear regression equation our exected value, when X=20 was 37.52. The difference is that the graph here is using all 14 significant digits of the equation and that causes a different, and more accurate, result. |
![]() |
For Figure 27 we have moved the highlight directly to the
X value 17 by pressing
![]() ![]() ![]() |
![]() |
We can get a closer look at the data points and the line by changing the
WINDOW settigns. We move to the WINDOW menu via
![]() |
![]() |
Figure 29 shows the modified WINDOW settings.
Here we 'have decided to only display X values
from 14 to 20 with an Xscl=1. The Y values range from
25 to 40.
Once these values are set we can return to the graph via
![]() |
![]() |
The new graph shows only the newly defined area. |
![]() |
We reenter TRACE mode via ![]() |
![]() |
Still, we can use the ![]() |
![]() |
We can continue to look at the points on our plot. In Figure 33 we have moved to the thirteenth point of the plot, X=16 and Y=33. |
![]() |
We want to find the residual value at X=16. Therefore, we need to
find the value of the linear regression equation when
X=16. We use ![]() |
![]() |
We prepare to move to X=16
by typing ![]() ![]() ![]() |
![]() |
Here the highlight is at X=16 and Y=31.56877. This gives us the expected value. The residual value is the (observed) – (expected), or in this case, 33-31.56877 = 1.43123. |
![]() |
Earlier, in Figures 28 and 29, we brought the focus of the screen into a smaller
region than the original settings of the calculator. We can do the same thing, but in a slightly
diifferent fashion. To get to Figure 37 we press
![]() ![]() ![]() |
![]() |
The calculator has a flashing plus sign at the same place where we left the cursor in Figure 36.
One might note that we are no longer in TRACE mode here. We can tell
that because there is no tracing information at the top of the screen.
We can move the flashing plus sign anywhere we want on the screen to pick out
the center of our new screen. Once in place, we press ![]() |
![]() |
Here is the new screen. We have narrowed the view to where we see only the one data point. |
![]() |
Use ![]() |
![]() |
We press ![]() |
![]() |
We press ![]() ![]() ![]() |
![]() |
Residual values are so important that the calculator calculates them whenever it does a
LinReg(ax+b) command. There is one residual value generated for each
of the paired X and Y values. The calcualtor puts these values into a new list
that is named RESID. We can find that list by opening the
LIST menu, via ![]() ![]() |
![]() |
Then we need to sue the ![]() |
![]() |
We press ![]() ![]() |
![]() |
The result is that the items in the list RESID are displayed.
Unfortunately, each item is so long that we really only get to see
the first item, in this case 1.90229727. We can use the
![]() |
![]() |
Figure 47 shows the start of the second number in RESID. Clearly, this is an inefficient way to look at the residual values. |
![]() |
As an alternative we could go back
and once again paste the RESID name onto the screen, but then follow it
with ![]() ![]() ![]() |
![]() |
Press ![]() ![]() |
![]() |
If we want to know the residual value associated with the
thirteenth data pair, X=16 and Y=33, then we can move
down the list to the 13th row
and see that the residual value is 1.4312.
We could safely exit the StatEditor via the ![]() ![]() |
![]() |
Back in the main screen, we see yet another way to look at the residual values. Again, this uses the list of residual values named RESID. We can get a display of any one of the values in that list by pasting the name of the list onto the main screen and tehn following it with the desired index value enclosed in parentheses. Thus the command RESID(13) displays the value in the thirteenth item of the list. |
©Roger M. Palay
Saline, MI 48176
September, 2012