Refresher - Regression Examples
A random sample of 11 statistics students produced the following data where x is the third exam score, out of 80, and y 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?
x (third exam score) |
65 |
67 |
71 |
71 |
66 |
75 |
67 |
70 |
71 |
69 |
69 |
y (final exam score) |
175 |
133 |
185 |
163 |
126 |
198 |
153 |
163 |
159 |
151 |
159 |
The third exam score, x, is the independent variable and the final exam score, y, is thedependent 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 least-squares regression line to obtain the best fit line.
Consider the following diagram. Each point of data is of the form (x,y) and each point of the line of best fit using least-squares linear regression has the form .
The is read "y hat" and is the estimated value of y. It is the value of y obtained using the regression line. It is not generally equal to y from data.
The term |yo-ˆyo|is called the "error" or residual. It is not an error in the sense of a mistake, but measures the vertical distance between the actual value of y and the estimated value of y.
ε=the Greek letter epsilon
For each data point, you can calculate, |yi-ˆyi|=εi,fori=1,2,3,...11.
Each ε is a vertical distance.
For the example about the third exam scores and the final exam scores for the 11statistics students, there are 11 data points. Therefore, there are 11 ε values. If you square each ε and add, you get
(ε21)+(ε22)+(ε23)+...+(ε211)=11∑i=1ε2i
This is called the Sum of Squared Errors (SSE).
Using calculus, you can determine the values of a and b 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.
Where a=(Sumy)(Sumx2)-(Sumx)(Sumxy)n(Sumx2)-(Sumx)2
and b=n(Sumxy)-(Sumx)(Sumy)n(Sumx2)-(Sumx)2.
The slope bb can be written as b=rsysx , where sy=the standard deviation of the y values and sx=the standard deviation of the x values. r is the correlation coefficient which is discussed in the next section.
Remember, the best fit line is called the least squares regression line (it is sometimes referred to as the LSL which is an acronym for least squares line). The best fit line for the third exam/final exam example has the equation: y'=-173.51+4.83x
The idea behind finding the best fit line is based on the assumption that the data are actually scattered about a straight line. Remember, it is always important to plot a scatter diagram first (which many calculators and computer programs can do) to see if it is worth calculating the line of best fit.
The slope of the line is 4.83(b=4.83). We can interpret the slope as follows: As the third exam score increases by one point, the final exam score increases by 4.83 points.
Note: 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 y given x within the domain of x-values in the sample data, but not necessarily for x-values outside that domain.