Data rarely fit a straight line exactly. Usually, you must be satisfied with rough
predictions. Typically, you have a set of data whose scatter plot appears to "fit" a
straight line. This is called a Line of Best Fit or Least Squares Line.
If you know a person's pinky (smallest) finger length, do you think you could predict that
person's height? Collect data from your class (pinky finger length, in inches). The
independent variable, xx, is pinky finger length and the dependent variable, yy, is height.
For each set of data, plot the points on graph paper. Make your graph big enough and
use a ruler. Then "by eye" draw a line that appears to "fit" the data. For your line, pick
two convenient points and use them to find the slope of the line. Find the yintercept of
the line by extending your lines so they cross the yaxis. Using the slopes and the
yintercepts, write your equation of "best fit". Do you think everyone will have the same
equation? Why or why not?
Using your equation, what is the predicted height for a pinky length of 2.5 inches?
A random sample of 11 statistics students produced the following data
where xx is the third exam score, out of 80, and yy is the final exam score, out of 200.
Can you predict the final exam score of a random student if you know the third exam score?
The third exam score, xx, is the independent variable and the final exam score, yy, is the
dependent variable. We will plot a regression line that best "fits" the data. If each of you
were to fit a line "by eye", you would draw different lines. We can use what is called a
leastsquares regression line to obtain the best fit line.
Consider the following diagram. Each point of data is of the the form (x,y)(x,y)and each point of
the line of best fit using leastsquares linear regression has the form
(
x
,
y
^
)
(x,
y
^
).
The y^y^ is read "y hat" and is the estimated value of yy. It is the value of yy obtained using the
regression line. It is not generally equal to yy from data.
The term y0y^0=ε0y0y^0=ε0 is called the "error" or residual. It is not an error in the
sense of a mistake. The absolute value of a residual measures the vertical distance between the actual value of yy and the
estimated value of yy.
In other words, it measures the vertical distance between the actual data point and the predicted point on the line.
If the observed data point lies above the line, the residual is positive, and the line underestimates the actual data value for y y. If the observed data point lies below the line, the residual is negative, and the line overestimates that actual data value for y y.
In the diagram above, y0y^0=ε0y0y^0=ε0 is the residual for the point shown. Here the point lies above the line and the residual is positive.
εε = the Greek letter epsilon
For each data point, you can calculate the residuals or errors, yiy^i=εiyiy^i=εi for i=1, 2, 3, ..., 11i=1, 2, 3, ..., 11.
Each εε is a vertical distance.
For the example about the third exam scores and the final exam scores for the 11
statistics students, there are 11 data points. Therefore, there are 11 εε values. If you
square each εε and add, you get
(
ε
1
)
2
+
(
ε
2
)
2
+
...
+
(
ε
11
)
2
=
Σ
i = 1
11
ε
2
(
ε
1
)
2
+(
ε
2
)
2
+...+(
ε
11
)
2
=
Σ
i = 1
11
ε
2
This is called the Sum of Squared Errors (SSE).
Using calculus, you can determine the values of aa and bb that make the SSE a minimum. When you make the SSE a
minimum, you have determined the points that are on the line of best fit. It turns out that
the line of best fit has the equation:
y
^
=
a
+
bx
y
^
=a+bx
(1)
where
a=y¯b⋅x¯a=y¯b⋅x¯
and
b=
Σ
(
x

x
¯
)
⋅
(
y

y
¯
)
Σ
(
x

x
¯
)
2
b=
Σ
(
x

x
¯
)
⋅
(
y

y
¯
)
Σ
(
x

x
¯
)
2
.
x¯x¯ and y¯y¯ are the sample means of the xx values and the yy values, respectively. The best fit line always passes through the point
(x¯,y¯)(x¯,y¯).
The slope bb can be written as
b=r⋅(
sy
sx)b=r⋅(
sy
sx) where sysy
= the standard deviation of the
yy values and sxsx = the standard deviation of the xx values. rr is the correlation
coefficient which is discussed in the next section.
The process of fitting the best fit line is called linear regression. The idea behind finding the best fit line is based on the assumption that the data are
scattered about a straight line. The criteria for the best fit line is that the sum of the squared errors (SSE) is minimized, that is made as small as possible. Any other line you might choose would have a higher SSE than the best fit line. This best fit line is called the least squares regression line .
Computer spreadsheets, statistical software, and many calculators can quickly
calculate the best fit line and create the graphs. The calculations tend to be tedious if done by hand. Instructions to use the TI83, TI83+, and TI84+ calculators to find the best fit line and create a scatterplot are shown at the end of this section.
The graph of the line of best fit for the third exam/final exam example is shown below:
The least squares regression line (best fit line) for the third exam/final exam example has the equation:
y
^
=
173.51
+
4.83x
y
^
=173.51+4.83x
(2) Remember, it is always important to plot a
scatter diagram first. If the scatter plot indicates that there is a linear relationship between
the variables, then it is reasonable to use a best fit line to make predictions for
yy given xx within the domain of xxvalues in the sample data, but not necessarily
for xxvalues outside that domain.
 You could use the line to predict the final exam score for a student who earned a grade of 73 on the third exam.
 You should NOT use the line to predict the final exam score for a student who earned a grade of 50 on the third exam, because 50 is not within the domain of the xvalues in the sample data, which are between 65 and 75.
The slope of the line, b, describes how changes in the variables are related. It is important to interpret the slope of the line in the context of the situation represented by the data. You should be able to write a sentence interpreting the slope in plain English.
INTERPRETATION OF THE SLOPE: The slope of the best fit line tells us how the dependent variable (y) changes for every one unit increase in the independent (x) variable, on average.
 Slope: The slope of the line is b = 4.83.
 Interpretation: For a one point increase in the score on the third exam, the final exam score increases by 4.83 points, on average.
 Step 1. In the STAT list editor, enter the X data in list L1 and the Y data in list L2, paired so that the corresponding (x,y) values are next to each other in the lists. (If a particular pair of values is repeated, enter it as many times as it appears in the data.)
 Step 2. On the STAT TESTS menu, scroll down with the cursor to select the LinRegTTest. (Be careful to select LinRegTTest as some calculators may also have a different item called LinRegTInt.)
 Step 3. On the LinRegTTest input screen enter: Xlist: L1 ; Ylist: L2 ; Freq: 1
 Step 4. On the next line, at the prompt β or ρ, highlight "≠ 0" and press ENTER
 Step 5. Leave the line for "RegEq:" blank
 Step 6. Highlight Calculate and press ENTER.
The output screen contains a lot of information. For now we will focus on a few items from the output, and will return later to the other items.
 The second line says y=a+bx. Scroll down to find the values a=173.513, and b=4.8273 ; the equation of the best fit line is
y
^
=
173.51
+
4.83x
y
^
=173.51+4.83x
 The two items at the bottom are
r2
r
2
= .43969
and
rr=.663.
For now, just note where to find these values; we will discuss them in the next two sections.
 Step 1. We are assuming your X data is already entered in list L1 and your Y data is in list L2
 Step 2. Press 2nd STATPLOT ENTER to use Plot 1
 Step 3. On the input screen for PLOT 1, highlight On and press ENTER
 Step 4. For TYPE: highlight the very first icon which is the scatterplot and press ENTER
 Step 5. Indicate Xlist: L1 and Ylist: L2
 Step 6. For Mark: it does not matter which symbol you highlight.
 Step 7. Press the ZOOM key and then the number 9 (for menu item "ZoomStat") ; the calculator will fit the window to the data
 Step 8. To graph the best fit line, press the "Y=" key and type the equation 173.5+4.83X into equation Y1. (The X key is immediately left of the STAT key). Press ZOOM 9 again to graph it.
 Step 9. Optional: If you want to change the viewing window, press the WINDOW key. Enter your desired window using Xmin, Xmax, Ymin, Ymax
**With contributions from Roberta Bloom