Scatter Plot, Correlation, and Regression on the TI-89
Copyright © 2007–2008 by Stan Brown, Oak Road Systems
Copyright © 2007–2008 by Stan Brown, Oak Road Systems
When you have a set of (x,y) data points and want to find the best equation to describe them, you are performing a regression. This page shows you how to determine the strength of the association between your two variables (correlation coefficient), and how to find the line of best fit (least squares regression line).
For an illustration of linear regression, we’ll use data from Dabes & Janik's Statistics Manual (1999). The explanatory variable x is dial settings on a freezer, and the response variable y is temperature of the freezer.
See also: a separate version of these instructions for the TI-83/84
Contents:
| Step 0. Setup |
| Step 1. Make the Scatter Plot |
| Step 2. Perform the Regression |
| Step 3. Display the Regression Line |
| Step 4 (optional). Display the Residuals |
| Set floating point mode, if you haven’t already. | [MODE] [▼] [▼] [►]
[ALPHA ÷ makes E] [ENTER]
|
The calculator will remember this setting when you turn it off: next time you can start with Step 1.
Before you even run a regression, you should first plot the points and see whether they seem to lie along a straight line. If the distribution is obviously not a straight line, don’t do a linear regression. (Some other form of regression might still be appropriate, but that is outside the scope of this course.)
| Turn off other plots. | [◆] [APPS] and select
Stats/List Editor.
[ F2] [3] [F2] [4] turns off all plots and functions. | ||||||||||||
Enter the numbers.
|
You will use two named lists for the x’s and
y’s. Any names are possible, but I’ll use
lx and ly because they’re short.
If those lists already exist, highlight the lx name
and press [CLEAR] [ENTER] to erase previous entries.
If lx isn’t there yet, move to an empty list
heading and press [L] [X]. (L is above the 4 key. When you
press 4 while naming a list, it will change to L automatically.)
Enter the x numbers, then clear list ly (or
create it) and enter the y numbers.
Note: You can hide an unwanted list by cursoring to the list name and pressing [ ◆ ← makes DEL]. The list
remains in memory until you use [2nd − makes VARLINK] to delete
it. | ||||||||||||
Set up the scatter plot.
|
[F2] [1] [F1] opens a dialog box. You want these
settings:
ENTER] to complete the definition. | ||||||||||||
Plot the points.
|
[F5] automatically adjusts the window
frame to fit the data. | ||||||||||||
(optional)You can adjust the grid to look better.
|
[◆ F2 makes WINDOW], set Xscl=1
and Yscl=5, then [◆ F3 makes GRAPH] to
redisplay it.
Appropriate values of Xscl and Yscl may
be different for other problems. Pick the values that make the
graph look best to you. |
| Set up to calculate statistics. | [◆] [APPS] and select Stats/List
Editor. |
|
[F4] [3] [2] brings up the LinReg(ax+b) dialog box. You
want these settings:
Press [ ENTER] to perform the regression and paste
the regression equation into Y1. |
Write down a (slope), b (y intercept), r (correlation coefficient;
r* is our symbol). Round a and b to two more decimal places
than your actual y values have; remember that final rounding should be
done only at the end of calculations. Round r* to two
decimal places unless it’s very close to ±1 or to 0.
a = −3.52
b = 6.46
r* = −0.992
R² is the coefficient of determination. The closer it is to 1, the better a predictor is the regression equation. Another way to look at it is that in this case R² is about 98%, so 98% of the variation in y is associated with the variation in x.
Statisticians say that R² tells you how much of the variation in y is “explained” by variation in x, but if you use that word remember that it means a numerical association, not necessarily a cause-and-effect explanation.
Only linear regression will have a correlation coefficient r, but any type of regression will have a coefficient of determination R² that tells you how well the regression equation predicts y from the independent variable(s). (The calculator uses r², but most authors use R².)
See also:
What does
R-squared
mean?
| Show line with original data points. |
[◆ F3 makes GRAPH] |
See also: Once you have the regression line, you can use the calculator to predict the y value for any x in the model.
See also: Do you wonder what sort of calculations the calculator does to find the best line? Least Squares, Down and Dirty explains what is meant by the “best” line and how to find it. Traditionally this is a calculus topic, but all that’s really necessary is some algebra.
See also: The above procedure computes the linear correlation of the sample. Decision Points for Correlation Coefficient gives a simple test whether there is some correlation in the population, but you can also compute the actual correlation in the population.
A plot of residuals can be helpful to show whether linear regression was the right choice.
If the residuals are more or less evenly distributed above and below the axis and show no particular trend, you were probably right to choose linear regression. But if there is a trend, you have probably forced a linear regression on non-linear data. If your data points looked like they fit a straight line but the residuals show a trend, it probably means that you took data along a small part of a curve.
The residuals are automatically calculated during the
and stored in a resid list in your Stats/List Editor;
all you have to do is plot them on the y axis against your existing x
data.
| Turn off other plots. | [F2] [3] [F2] [4] |
Set up the plot of residuals against the x data.
![]() |
[F2] [1] [▼] [F1] selects Plot 2 and opens a dialog
box. You want these settings:
ENTER] to complete the definition. |
| Display the plot. |
[F5] displays the plot. |
Don’t worry about the magnitude of the residuals,
because [ZOOM] [9] adjusts the vertical scale so that the points
take up the full screen. What you want to look at is
whether there’s a trend in the residuals. Here there is
no trend, so you conclude that a linear regression was the right
choice, as opposed to regression against some curve.
home page | problems with viewing?
This page is used in instruction at Tompkins Cortland Community College in Dryden, New York; it’s not an official statement of the College. Please visit www.tc3.edu/instruct/sbrown/ to report errors or ask to copy it.
For updates and new info, go to http://www.tc3.edu/instruct/sbrown/ti83/