{{ 'ml-label-loading-course' | message }}
{{ toc.name }}
{{ toc.signature }}
{{ tocHeader }} {{ 'ml-btn-view-details' | message }}
{{ tocSubheader }}
{{ 'ml-toc-proceed-mlc' | message }}
{{ 'ml-toc-proceed-tbs' | message }}
Lesson
Exercises
Recommended
Tests
An error ocurred, try again later!
Chapter {{ article.chapter.number }}
{{ article.number }}. 

{{ article.displayTitle }}

{{ article.intro.summary }}
Show less Show more expand_more
{{ ability.description }} {{ ability.displayTitle }}
Lesson Settings & Tools
{{ 'ml-lesson-number-slides' | message : article.intro.bblockCount }}
{{ 'ml-lesson-number-exercises' | message : article.intro.exerciseCount }}
{{ 'ml-lesson-time-estimation' | message }}
There are several ways to analyze how well a line of fit models a data set. In this lesson, the differences between observed data points and the points predicted by the line of fit will be calculated to determine if the regression line models the data well.

Catch-Up and Review

Here are a few recommended readings before getting started with this lesson.

Explore

Scatter Plot of Bivariate Data and Line of Fit

Consider the scatter plot of bivariate data. Move the the line in such a way that it models the data.
Scatter plot of data and line
For the different data sets, draw the line of fit. How can it be determined if this line models the data well?
Discussion

Residual

One way to assess how well a line of fit describes the data is to analyze residuals.

Concept

Residual

A residual is the vertical distance between a data point and the line of fit. When a line of fit has been drawn on a scatter plot, not all of the data points lie exactly on the line — some of them are above the line and some below. Therefore, each data point has one residual, which can be positive, negative, or zero.

Showing positive, negating, and zero residuals for a line of fit

A residual can also be defined as the observed value of a data point minus its predicted value, found using the line of fit.

Generally, the smaller the absolute values of the residuals, the more reliable the line of fit is. A scatter plot of the residuals can be used to determine how well a model fits data set. The independent variable and the residuals are graphed as ordered pairs
The appropriate models can be determined by looking at the scatter plot of residuals.
  • If the points in the plot are randomly placed about the axis, then a linear model describes the data set well.
  • If some kind of pattern appears in the scatter plot, a non-linear model is more appropriate for the data.
Pop Quiz

Practice Finding Sum of Squared Residuals

The applet generates bivariate data and the equation of a line of fit for the data. Calculate the sum of the squares of the residuals for the given equation.

Bivariate data and equation of line of fit
For a line of fit, large negative residuals are as bad as large positive ones. By squaring the residual values, positive and negative residuals are treated in the same way. A high sum of squares indicates high variability in the set of observations. Therefore, the lower the sum of squared residuals, the better the line of fit.
Example

Determining Which Line of Fit Is Better

The table below shows the finishing times, in seconds, for the Olympic gold medalist in the men's meter dash for the last six Olympic games. Olympic Game represents the Olympic games and Olympic Game represents the Olympic games.

Olympic Game
Finishing Time (sec)
a The following equations can model the data set.
In these equations, represents the Olympic Game number as described above, and represents the finishing time in seconds. For each equation, calculate the sum of squared residuals. Which of the equations is a better fit?
b Make a scatter plot for the residuals.

Answer

a Sum of Squared Residuals for Equation I:

Sum of Squared Residuals for Equation II:

Which equation is a better fit? Equation II
b Graph:
Scatter plot of the residuals for the equations

Hint

a Make a table of the residual values for each equation and then find the sum of the squares of the residuals.
b Plot the points on a coordinate plane.

Solution

a For the given data set, there are two possible lines of fit.
In order to determine which line of fit is better, the residuals for both lines will be calculated first. For a data point, its residual is the difference between the value of the data point and the value predicted by the line of fit.
(Actual) Predicted by Residual for
The values on the last column of the table will be squared and added.
The sum of squared residuals for Equation I, is Similarly, the residuals for Equation II will be calculated.
(Actual) Predicted by Residual for
Now that the residuals are found, they can be squared and added.
The sum of squared residuals for Equation II, is As a result, Equation II is the better line of fit because it has a lesser sum of squared residuals.
b Recall the residuals for the equations found in the previous part.
Residual for Residual for

The points for each equation will be graphed on a scatter plot.

Scatter plot of the residuals for the equations

As can be seen, the residuals for Equation II are close the axis and therefore the sum of their squares has a lower value.

Example

Finding the Sum of Squared Residuals Less Than a Certain Value

Maya is researching used cars similar to the one her older sister drives. She found some data showing the mileages in thousands of miles, and the selling prices in thousands dollars, of several used cars near her.

Maya wants to write the equation of a line of fit for this data set. She knows that the smaller the values of the residuals, the more reliable the line of fit is. She then decides to write an equation in such a way that the sum of squared residual is less than Help Maya write an equation that satisfies the condition.

Answer

Example Equation:

Hint

Start by making a scatter plot for the given data set. Draw a line that passes through two data points and write its equation. Then, calculate the residuals for the equation.

Solution

First, the given data will be shown on a graph. Then, a line that passes close to the points will be drawn.
Scatter plot of the data set and a line of fit
It appears that the line passes through the points and Knowing two points on the line, the slope of the line and its equation can be found. To find the slope, the points need to be substituted into the Slope Formula.
Evaluate right-hand side
Next, using and either point, the equation of the line can be written in the point-slope form. Use and
To write the equation in slope-intercept form, will be isolated.
Solve for
Finally, the residuals for this equation can be calculated. To do so, the difference between the value of a data point and the corresponding value predicted by the line of fit will be calculated for each data point.
(Actual) Predicted by the equation Residual
Next, the sum of squared residuals can be found by adding the squares of the numbers in the last column of the table.
Evaluate
The sum of squared residuals for the equation is
This equation does not satisfy the condition that Maya wants. Another equation can be found by slightly increasing the slope of the above equation and slightly decreasing its intercept. Use the applet below to find an equation. For example, can be a good candidate.
Finding the equation of a line of fit satisfying the condition
The residuals for this equation can be found as follows.
(Actual) Predicted by the equation Residual
Now, the sum of squared residuals for this equation can be calculated.
Evaluate
As a result, the sum of squared residuals for satisfies the condition.
Note that there are numerous equations that satisfy Maya's condition. Here only one of them was shown. The following applet shows the equation of a line fit and the sum of squared residuals. Use it to see how the sum changes as the equation changes.
Pop Quiz

Practice Determining the Better Model

The applet generates bivariate data and two equations that model the data. To see the coordinates of a data point, move the cursor over it. Use the sum of squared residuals to determine the better fit for the data.

Scatter plot of data and two lines of fit
Closure

Finding the Line That Is the Best Fit

In this lesson, lines of fit and their residuals have been analyzed. When a line models a data set well, the sum of the squared residuals for the line is relatively small. Move the points and the line in the graph to see how the residuals and the sum of their squares change.
Data modeled by a line and the sum of squared residuals
The question then arises as to whether there is a line whose sum of squared residuals is less than the sum of the squared residuals of any other line of fit. In the next lesson, the line of best fit will be defined and its equation will be derived.
Loading content