1.6 Expanding on Linear Regression
Section Overview
- Interactive 1.6.1 - Example 1.5.1
- Example 1.6.1 - R. Plot & SD of Res. on Calc
- Gallery 1.6.1
- Interactive 1.6.2 - Example 1.6.1
- Pop Quiz 1.6.1
Predicting the Response
In the previous section, we talked about how in the least-squares regression line equation was the predicted value of the response variable for a given value of an explanatory variable . However, that predicted value was probably different than the actual observed value. This difference is called the residual, and is one of the previously mentioned “vertical lines” minimized through linear regression. It is defined as:
where
- = observed value of response
- = predicted value of response
See Interactive 1.6.1 to see the residuals of the scatterplot from Example 1.5.1, the backpack problem.
Interactive 1.6.1 Example 1.5.1 (Observed and Predicted Values)
We can also use the regression line to predict a y-value from an x-value not originally in our data set. However, we have to be careful of extrapolation, using the regression line to predict values outside our range of data.
Fitting the Regression Line to the Data
One way to determine if a regression line fits your data is to construct a residual plot, a graph where the regression line becomes and the residuals are perpendicular to it.
When examining a residual plot, we want to look for two things:
- The residual plot should not have a clear form. In other words, the data points should be scattered about randomly on the plot. Otherwise, it is indicative that a form other than a line would be a better model for the data.
- The residuals should be relatively small. A good measure of this is the standard deviation of the residuals , the average amount of variation in the residuals. It is found by using the formula
where
- = sum of squared residuals and
- = number of observations in data set
Another way to determine if a regression line fits your data is to calculate the coefficient of determination . We might have caught a glimpse of this value on our calculator screen when performing the linear regression function on our backpack problem. It is the percentage of variation accounted for in your response variable by relating your response variable to your explanatory variable . If this sounds confusing, don’t worry; the following example problem will clear things up for you!
Before we attempt to tackle the example problem however, we want to make one last point about fitting a regression line to data. As we mentioned in the last section, the correlation coefficient is not resistant to outliers and by extension neither is the least-squares regression line. If either the regression line or the correlation coefficient change significantly by removing an outlier, the outlier is called an influential observation.
Example 1.6.1
Example 1.6.1 a) — recorded answer
a) When we extrapolate, we are predicting values outside of our given range of data. If we wanted to find out what backpack weight would be needed for a student to have a 100% GPA, using the regression formula we found in Example 1.5.1, we get:
where !
If the student had a 60% GPA, we get:
where ! Stop the madness!
Gallery 1.6.1 Example 1.6.1 (Creating Residual Plots and Finding Standard Deviation of Residuals on TI 83-84)
Frame 1 of 10
Press the STAT button and under EDIT, select “Edit” and press ENTER Open full-size image S0114Frame 2 of 10
L1 and L2 contain the information from Example 1.5.1. L3 contains the predicted values from the regression line Open full-size image S0115Frame 3 of 10
L4 contains the residuals, which is L2 (observed values) - L3 (predicted values). Open full-size image S0116Frame 4 of 10
Press 2nd > Y= to get to STAT PLOTS. Press Enter on Plot 1. Open full-size image S0117Frame 5 of 10
Set the default type as a scatterplot, choose L1 and L4 as your Xlist and Ylist. Open full-size image S0118Frame 6 of 10
Press Zoom and select ZoomStat Open full-size image S0119Frame 7 of 10
Press GRAPH and you will see the residual plot. Open full-size image S0120Frame 8 of 10
Go to STAT > CALC and select 1-Var Stats Open full-size image S0121Frame 9 of 10
You will be taken back to the home screen. Press 2nd > 4 for L4 and press ENTER. Open full-size image S0122Frame 10 of 10
The 1-Var Statistics for the residuals are displayed. We need the square of the residuals in order to find the standard deviation of residuals, which is 350.57. Open full-size image S0123
Capture provenance
Filename capture times, with no recorded timezone. Frames above follow the original gallery positions.
- · S0114 · displayed frame 1
Screenshot 2026-10-05 at 3.45.19 PM.png - · S0115 · displayed frame 2
Screenshot 2026-10-05 at 3.45.25 PM.png - · S0116 · displayed frame 3
Screenshot 2026-10-05 at 3.45.32 PM.png - · S0117 · displayed frame 4
Screenshot 2026-10-05 at 3.45.37 PM.png - · S0118 · displayed frame 5
Screenshot 2026-10-05 at 3.45.43 PM.png - · S0119 · displayed frame 6
Screenshot 2026-10-05 at 3.45.48 PM.png - · S0120 · displayed frame 7
Screenshot 2026-10-05 at 3.45.54 PM.png - · S0121 · displayed frame 8
Screenshot 2026-10-05 at 3.46.00 PM.png - · S0122 · displayed frame 9
Screenshot 2026-10-05 at 3.46.05 PM.png - · S0123 · displayed frame 10
Screenshot 2026-10-05 at 3.46.11 PM.png
The list-entry instructions shown in frames 2 and 3 are:
The displayed list rows in those two frames are transcribed as captured:
| L1 | L2 | L3 | L4 |
|---|---|---|---|
| .56 | 79 | 81.145 | -.2573 |
| .67 | 80 | 81.154 | -1.667 |
| .86 | 79 | 81.17 | -2.829 |
| 1.09 | 84 | 81.19 | 1.9756 |
| 1.54 | 82 | 81.228 | -.4072 |
| 1.89 | 83 | 81.258 | .29499 |
| … | … | … | … |
| 6.27 | 87 | 81.63 | .56848 |
| 8.3 | 81 | 81.803 | -7.159 |
The final calculator screen displays these residual summary values:
| Statistic | Displayed value |
|---|---|
| Mean | 3.0971429E-4 |
| Sum | .006504 |
| Sum of squares | 350.572248 |
| Sample standard deviation | 4.186718563 |
| Population standard deviation | 4.085818951 |
| n | 21 |
Example 1.6.1 b) — recorded answer
b) See Gallery 1.6.1 for instructions on creating a residual plot. Examining the residual plot, we can see that replacing the observed response with the residual for the y-value gives us the line with the data points above or below this line. We can see that residual plot does not have a clear form with the data points scattered about randomly on the plot. This means that a line is the best model for the data. However, the residuals are fairly large, especially the ones for the outliers.
To determine just how large on average the residual is, or the standard deviation of the residuals, we look at Gallery 1.6.1 (last image) for calculating the sum of the squared residuals. We get . Plugging this into our formula, we get:
This means our predictions for GPA on average will be off by about 4.3%.
Example 1.6.1 c) — recorded answer
c) The coefficient of determination was found when we went through the steps in performing the LinReg(a+bx) function in Gallery 1.5.3. We found the value to be . This means that only about 14% of the variation in GPA is accounted for by the least-squares regression of GPA on backpack weight. 86% of the variation unaccounted for could be due to other factors, such as study habits, motivation, and intelligence.
Example 1.6.1 d) — recorded answer
d) A quick and easy way to tell if either of our outliers is also an influential observation is to remove each outlier one at a time from our data set, perform the LinReg(a+bx) function, and record the correlation. If we want to remove the outlier in the y direction, we have to remove 2.53 kg and 72% from the and lists on our calculator.
Performing the LinReg(a+bx) function, we get . This doesn’t seem like a big change from our original correlation with the y outlier included, , but to be sure, we want to perform the same procedure on the x outlier, the student with the 8.3 kg backpack and the 81% GPA. Putting 2.53 and 72 back into and , removing the coordinates for the x outlier in the two lists, and performing the LinReg(a+bx) function, we get . This seems like a pretty significant change relative to removing the y outlier, so we can conclude that the child with the the 8.3 kg backpack and the 81% GPA is an influential observation. This is confirmed with Interactive 1.6.2, where the regression line representing the data set without the x outlier is in a significantly different position than the other two regression lines.
What can we conclude from this problem? From the large standard deviation of the residuals, the small coefficient of determination, and the presence of influential outliers, we can conclude that backpack weight alone cannot effectively predict the GPA of a student. Maybe those students should have bought some Omniguides, instead!
Interactive 1.6.2 Example 1.6.1
The fully visible comparison box reads Without Y Outlier, , .
Pop Quiz 1.6.1
Option D’s square-root expression is .
Glossary and deeper reading · 10 refreshers
These editorial refreshers supplement the reading. Definitions and examples are added guidance; original source wording and recorded answers remain in their original context.
-
Least-squares regression
Least-squares regression fits a line predicting a response from an explanatory variable. The fitted line minimizes the sum of squared vertical residuals between observed and predicted responses. For example, a fitted line can predict a plant’s height from its age, within the range of observed ages.
Read more: Least-squares regression in the captured Statistics reading →
-
Response variable
A response variable records the outcome being studied. Its relationship to an explanatory variable can be investigated without assuming that the explanatory variable causes it. For example, plant height is a response when researchers compare fertilizer treatments.
Read more: Response variable in the captured Statistics reading →
-
Residual
A residual is an observed response minus its predicted response. A positive residual places the observed point above the fitted line, while a negative residual places it below. For example, an observed height of 18 centimeters and a predicted height of 16 centimeters give a residual of 2 centimeters.
-
Scatterplot
A scatterplot displays paired values of two quantitative variables as points. The horizontal coordinate represents one variable and the vertical coordinate represents the other. For example, plotting hours studied against test scores helps reveal a pattern without establishing causation.
-
Observation
An observation is a recorded value or set of values for an individual or occasion. The individual may be a person, object, or event rather than a human subject. For example, one plant’s measured height is an observation in a plant-growth study.
-
Standard deviation of residuals
The standard deviation of residuals estimates the typical prediction error around a fitted regression line. For simple linear regression it is the square root of the sum of squared residuals divided by the sample size minus 2. For example, a residual standard deviation of 3 points indicates scatter around predictions on the scale of a few score points.
-
Coefficient of determination
The coefficient of determination is the fraction of observed response variation accounted for by a fitted regression model. In simple linear regression with an intercept, it equals the square of the correlation coefficient. For example, a value of 0.64 means that the fitted linear model accounts for 64% of the response variation in those data.
-
Explanatory variable
An explanatory variable is used to predict or explain variation in a response variable. In an experiment, researchers deliberately assign values or treatments related to an explanatory variable. For example, assigned study time could be an explanatory variable when test score is the response.
Read more: Explanatory variable in the captured Statistics reading →
-
Correlation coefficient
Pearson’s correlation coefficient measures the direction and strength of a linear relationship between two quantitative variables. It ranges from −1 to 1, and a value near 0 does not rule out a strong curved relationship. For example, points closely following a decreasing straight line have correlation near −1.
Read more: Correlation coefficient in the captured Statistics reading →
-
Resistant measure
A resistant measure changes relatively little when a small number of observations become extreme. Resistance means reduced sensitivity, rather than complete immunity to every change in the data. For example, changing a largest value from 30 to 300 may leave the median unchanged while substantially increasing the mean.
Read more: Resistant measure in the captured Statistics reading →