Tutorials › AP Statistics › Residuals on a Scatterplot With the Line

Residuals · Tutorial 885 of 1000

Residuals on a Scatterplot With the Line

Learn how the vertical gap from a plotted point to the fitted line represents a residual, and how to judge its direction and size.

Intermediate 9 min read

What You'll Learn

  • Identify the point and the fitted-line value at the same predictor value.
  • Explain why a residual segment is vertical rather than horizontal or perpendicular to the line.
  • Connect a point’s position above or below the line to the sign of its residual.
  • Judge residual size using the response-axis scale and vertical distance.
  • Compare residual magnitudes while keeping their signs distinct.
  • Describe what points on the fitted line and equal-length segments mean.

Finding the Residual Segment on a Scatterplot

In “Interpreting a Residual in Context,” you used a residual to describe how far a model’s prediction was from an observed response. On a scatterplot that shows the fitted line, this difference has a visible representation: it is the vertical segment between an observed point and the line at the same predictor value.

To find that segment, start at the observed point and move straight up or down until you reach the fitted line. The segment is vertical because the comparison holds the predictor value \(x\) fixed: it compares the observed response \(y\) with the line’s predicted response \(\hat{y}\) for that same \(x\). A horizontal segment would change the predictor value instead, so it would not show the residual.

Definition: On a scatterplot with a fitted line, an observed point’s residual is represented by the vertical segment connecting that point to the fitted line at the same \(x\)-value. The segment’s vertical distance is the residual’s magnitude, \(|y-\hat{y}|\). Its direction—above or below the line—shows the residual’s sign.

As established in “Defining a Residual as Observed Minus Predicted” and “Sign of a Residual: Over- and Underprediction,” the residual is \(y-\hat{y}\). If the point is above the line, its observed response is greater than the prediction, so the residual is positive. If the point is below the line, its observed response is less than the prediction, so the residual is negative. A point on the line has a residual of zero.

$$ \text{residual}=y-\hat{y} \qquad\text{and}\qquad \text{vertical distance}=|y-\hat{y}| $$

The segment’s length shows the size of the prediction error, but its direction supplies information too. For example, a segment extending 4 response units above the line represents a residual of \(+4\); one extending 4 units below represents a residual of \(-4\). These residuals have equal magnitudes but opposite signs.

Read the Gap Along the Response Axis

A scatterplot may not display a separate segment for every point. Even so, you can identify a residual by locating where the fitted line passes above or below a plotted point at the same horizontal position. The line’s height there is the predicted response; the point’s height is the observed response. The vertical gap between those heights is the residual segment.

To judge the gap’s size, read the response-axis scale. If each grid interval represents 2 response units and the point is one-and-a-half intervals from the line, the vertical distance is about 3 response units. If the scale is labeled in tens, a gap of half an interval is about 5 response units. Estimate from the axis labels, not just from how many pixels the segment seems to occupy.

A residual is measured in the response variable’s units. If the response is plant height in centimeters, a vertical segment represents centimeters; if the response is travel time in minutes, it represents minutes. The segment does not represent a change in the predictor. Also, its length is not generally the shortest distance from the point to the line: the residual uses a vertical, not perpendicular, comparison.

How to read a residual segment:
  • Find the observed point and its \(x\)-value.
  • At that same \(x\)-value, locate the fitted line and its predicted response.
  • Follow the vertical gap between the point and the line. Use the response-axis scale to judge its length.
  • Report the sign from the point’s position: above the line is positive; below the line is negative; on the line is zero.

Comparisons are clearest when the segments are on the same plot and share the same response axis. A segment that is visibly longer represents a larger residual magnitude. Across separate plots with different vertical scales or aspect ratios, apparent pixel lengths can be misleading; compare the values in response units instead.

Worked Example: A Greenhouse Point Above the Line

Worked Example: A Greenhouse Point Above the Line

A fictional greenhouse class plots \(x\), the amount of a nutrient solution in liters, against \(y\), plant height in centimeters. Its fitted line is \(\hat{y}=8+1.5x\). On the scatterplot, one observed plant is represented by the point \((4,17)\). Describe the residual segment and judge its size.

State. The observed point is at \(x=4\) liters and \(y=17\) centimeters. The residual segment runs vertically between this point and the fitted line’s prediction at \(x=4\).

Plan. Find the line’s height at the point’s \(x\)-value. Compare the observed height with that predicted height. The difference determines the vertical distance and the point’s position relative to the line determines the sign.

Do. The fitted line predicts:

$$ \hat{y}=8+1.5(4) =8+6 =14\text{ centimeters}. $$

At \(x=4\), the line is at 14 centimeters while the point is at 17 centimeters. Thus the vertical segment extends from the point down to the line, a gap of:

$$ y-\hat{y} =17-14 =3\text{ centimeters}. $$

Conclude. The point is 3 centimeters above the fitted line, so its residual is \(+3\) centimeters. The segment’s vertical length is 3 centimeters. In context, the line underpredicted this plant’s height by 3 centimeters.

Notice that finding the segment does not mean moving left or right from the point. Both the point and its prediction use \(x=4\); only the response value changes along the vertical direction.

Worked Example: A Commute Point Below the Line

Worked Example: A Commute Point Below the Line

A fictional transportation class plots cycling distance \(x\), in kilometers, against travel time \(y\), in minutes. The fitted line is \(\hat{y}=12+2x\). A plotted commute is at \((6,21)\). Identify the residual segment, including its direction and size.

State. The observed commute took 21 minutes for a 6-kilometer trip. The relevant line height is the fitted value at that same distance, \(x=6\).

Plan. Substitute 6 into the fitted line. Then compare the observed travel time with the prediction to determine how far below or above the line the point appears.

Do. The line’s predicted time at 6 kilometers is:

$$ \hat{y}=12+2(6) =12+12 =24\text{ minutes}. $$

The point is at 21 minutes, which is 3 minutes lower than the line at the same \(x\)-value:

$$ y-\hat{y} =21-24 =-3\text{ minutes}. $$

Conclude. The residual segment extends vertically upward from the point to the line and is 3 minutes long. Because the point is below the line, the signed residual is \(-3\) minutes. The model overpredicted this commute’s travel time by 3 minutes.

The segment has a positive length of 3 minutes, even though the residual is \(-3\) minutes. The negative sign records the direction of the difference \(y-\hat{y}\); it does not make a geometric distance negative.

Compare Segments Without Losing Their Signs

When judging several plotted residuals, keep two questions separate: Which segment is longer, and which points are above or below the line? The first compares magnitudes; the second identifies signs. A long segment below the line has a large negative residual, while a shorter segment above the line has a smaller positive residual.

For example, suppose two vertical segments on the same plot have lengths of 5 and 2 response units. If the first extends below the fitted line and the second extends above it, their residuals are \(-5\) and \(+2\), respectively. The first has the greater magnitude because \(5>2\), but its sign is negative. Calling it “the largest residual” can be ambiguous: say “the greatest residual magnitude” when comparing distances, and state signs separately.

A point exactly on the fitted line has no visible gap, so its residual is zero. Two points can also have equal-length segments on opposite sides of the line. Those residuals are equal in magnitude but not equal as signed values.

Worked Example: Compare Three Plotted Points

Worked Example: Compare Three Plotted Points

A fictional school garden displays plant-height observations and the fitted line \(\hat{y}=10+2x\), where \(x\) is the number of weeks after planting and \(y\) is height in centimeters. Three points shown on the same plot are \(A=(2,16)\), \(B=(5,17)\), and \(C=(4,18)\). Which point has the greatest residual magnitude, and what does each vertical segment show?

State. Each point’s segment connects its observed height to the fitted-line height at the same number of weeks. Because all three points appear on the same plot, their vertical distances can be compared using the same centimeter scale.

Plan. Evaluate the line at each point’s \(x\)-value. Subtract that predicted height from the observed height to obtain the signed residual. Compare the absolute values to identify the longest segment.

Do. For point \(A=(2,16)\), the line predicts:

$$ \hat{y}_A=10+2(2)=14\text{ centimeters}, \qquad 16-14=+2\text{ centimeters}. $$

So \(A\)'s point is 2 centimeters above the line. For point \(B=(5,17)\):

$$ \hat{y}_B=10+2(5)=20\text{ centimeters}, \qquad 17-20=-3\text{ centimeters}. $$

So \(B\)'s point is 3 centimeters below the line. For point \(C=(4,18)\):

$$ \hat{y}_C=10+2(4)=18\text{ centimeters}, \qquad 18-18=0\text{ centimeters}. $$

Point \(C\) lies on the line, so it has no vertical segment of positive length.

Conclude. The signed residuals are \(+2\), \(-3\), and \(0\) centimeters for \(A\), \(B\), and \(C\), respectively. Their magnitudes are 2, 3, and 0 centimeters. Point \(B\) has the greatest residual magnitude, with a 3-centimeter segment below the line; \(A\)'s segment is shorter and above the line; \(C\) has zero residual.

This comparison illustrates why position and length should not be confused. Point \(A\) is above the line, but its segment is not the longest. Point \(B\) is below the line and has the greatest distance from the line among these three.

Common Mistakes and AP Exam Tips

A complete plot-based answer identifies the vertical segment at the point’s own \(x\)-value, uses the response-axis scale to describe its size, and states whether the point is above or below the line. If the question asks for a residual, include its sign; if it asks for distance or magnitude, give the nonnegative length.

  • Drawing or imagining a horizontal gap. A residual compares observed and predicted responses for the same predictor value. The correct segment is vertical.
  • Using the nearest point on the line. The residual is measured vertically to the line at the observed point’s \(x\)-value, not along the shortest perpendicular route.
  • Reversing the sign. A point above the line has a positive residual; a point below the line has a negative residual. This follows from observed minus predicted.
  • Confusing signed residual with segment length. A \(-3\)-unit residual has a segment of length 3 units. The sign describes direction, not negative distance.
  • Reading only the picture’s apparent size. Use tick marks and response-axis units. If the axis scale is not uniform or the scale is unclear, do not claim a precise numerical length from appearance alone.
  • Comparing residuals without clarifying magnitude. When one question asks which gap is largest, compare absolute values or vertical lengths. Then mention whether the corresponding point is above or below the line.
  • Using predictor units. The gap is measured in the response’s units. A height residual is in centimeters, not weeks; a travel-time residual is in minutes, not kilometers.

A useful visual check is to imagine a vertical guide through the observed point. Where that guide crosses the fitted line is the prediction for the point. The gap from the crossing to the point gives the residual segment; its position and the response-axis scale tell you the sign and size.

Key takeaway: A residual on a scatterplot is the vertical gap from an observed point to the fitted line at the same \(x\)-value. The gap’s length is the residual’s magnitude in response units; a point above the line has a positive residual, and a point below it has a negative residual.

Check Your Understanding

Use the fitted line and plotted coordinates in each question to describe the residual segment. State its direction and size, and include the signed residual when requested.

  1. A fitted line is \(\hat{y}=5+3x\). An observed point is \((4,19)\). At what response value is the line when \(x=4\), and how long is the vertical segment?
  2. On a plot, a point is 2 response units below the fitted line. Is its residual positive or negative? What is the segment’s length?
  3. Two points have residuals \(+4\) centimeters and \(-4\) centimeters. Compare their segment lengths and their positions relative to the line.
  4. Why is a horizontal segment from an observed point to the fitted line not the representation of that point’s residual?
  5. A point lies exactly on the fitted line. What is the length of its residual segment, and what is its residual?