Tutorials › Regression Analysis (Undergraduate) › What a Straight-Line Fit Leaves Unexplained

Fitting a Simple Linear Regression · Tutorial 95 of 991

What a Straight-Line Fit Leaves Unexplained

Compare observed and fitted responses, calculate residuals, and use their plot to see what a straight-line fit leaves unexplained.

Beginner 9 min read

What You'll Learn

  • Distinguish an observed response from its fitted response.
  • Calculate and interpret a residual in the response variable’s units.
  • Read a residual plot relative to its zero reference line.
  • Recognize patterns that a straight-line fit has not captured.
  • Explain why residuals are not causes or guarantees of prediction accuracy.

What the Line Summarizes—and What It Does Not

A simple linear regression line gives a compact description of how a response tends to change as a predictor changes. But a fitted value on the line is not necessarily the observed response for any particular case. Individual observations can fall above or below it, and the differences can matter: they show where the line misses and whether those misses look like random scatter or a systematic pattern.

For each case, compare its observed response with the response fitted at that case’s predictor value. The difference is called a residual. Looking at these differences in a residual plot helps separate the broad straight-line trend from case-to-case departures that the line does not represent.

Definition: For case \(i\), let \(x_i\) be its observed predictor value and \(y_i\) its observed response. A fitted simple linear regression line has the form \(\hat{y}_i=b_0+b_1x_i\), where \(\hat{y}_i\) is the fitted response, \(b_0\) is the estimated intercept, and \(b_1\) is the estimated slope. The residual is \(e_i=y_i-\hat{y}_i\). Thus, the observed response is the fitted response plus the residual: \(y_i=\hat{y}_i+e_i\).

A residual is a vertical difference on a scatterplot: the observed response minus the point on the fitted line at the same predictor value. A positive residual means the observation is above the line; a negative residual means it is below. Its units are the units of the response. A residual of 2 minutes, for example, means the observed time is 2 minutes greater than its fitted value for that case.

The equation \(y_i=\hat{y}_i+e_i\) is a bookkeeping identity, not a claim that the fitted value and residual have separate physical causes. The line gives the fitted part of the response, while the residual records the difference for that observed case. A residual by itself does not say why the case differs from the line.

Comparing Observed and Fitted Responses

Suppose the response is a student’s score on a practice assessment and the predictor is hours spent studying. The fitted value is the score given by the estimated line at a student’s study time. The residual is the student’s actual score minus that fitted score. A residual of \(-3\) points indicates an observed score 3 points below the line’s fitted score; it does not mean the student lost 3 points because of studying.

In a least-squares fit with an intercept, the line is chosen to minimize the sum of squared residuals among straight lines. This does not mean every residual is small, nor that the line explains every difference between cases. It means that, among the candidate lines, this one has the smallest total squared vertical discrepancy for the observed data. The residual plot helps us inspect the pattern of what remains.

Worked Example: Reading Observed and Fitted Values

Consider hypothetical data relating a predictor \(x\), measured in hours, to a response \(y\), measured in points. Suppose the fitted line is \(\hat{y}=50+2x\). For a case with \(x=4\) hours and observed response \(y=57\) points, find and interpret the fitted value and residual.

Fitted response. Substitute the observed predictor value into the line:

$$ \hat{y}=50+2(4)=58\text{ points}. $$

Residual. Subtract the fitted response from the observed response:

$$ e=57-58=-1\text{ point}. $$

The observed score is 1 point below the fitted score at 4 hours of study. The identity checks: \(57=58+(-1)\). The negative sign describes the case’s position relative to the line; it is not evidence that studying reduced the score.

How to Read a Residual Plot

A residual plot places predictor values \(x_i\) on the horizontal axis and residuals \(e_i\) on the vertical axis. The horizontal reference line at residual zero represents exact agreement between observed and fitted responses. Points above it have positive residuals; points below it have negative residuals. The vertical scale uses the response variable’s units.

The purpose is not simply to see whether points lie close to zero. Instead, look for how their positions change across the predictor range. A roughly patternless cloud around zero is consistent with the straight line having captured the main systematic trend in the observed data. A curve or other organized shape indicates that the departures are not just scattered without structure: the fitted straight line has missed a feature of the data.

1
Calculate the fitted response.
For each case, substitute its predictor value into the fitted line to obtain \(\hat{y}_i\).
2
Calculate the residual.
Subtract the fitted response from the observed response: \(e_i=y_i-\hat{y}_i\). Keep the response units.
3
Plot and inspect.
Plot each residual against its predictor value, include the zero reference, and look for systematic shapes or changing spread.

This is a descriptive check of the fit, not a formal test. The zero reference is useful because the sign and size of every residual are read relative to it. Also notice the scale: residuals varying by a few response units tell a different practical story from residuals varying by hundreds, even if both plots have a similar shape.

Worked Example: A Curved Pattern Left by a Straight Line

Suppose a hypothetical data set has predictor values \(x=1,2,3,4,5\), and the fitted line is \(\hat{y}=10+3x\). The observed responses are \(15,15,17,21,27\), respectively. Calculate the fitted values and residuals, then describe the residual plot.

For each case, calculate \(\hat{y}_i=10+3x_i\), then \(e_i=y_i-\hat{y}_i\):

\(x_i\)\(y_i\)\(\hat{y}_i=10+3x_i\)\(e_i=y_i-\hat{y}_i\)
115132
21516-1
31719-2
42122-1
527252

For example, at \(x=4\), the fitted response is \(10+3(4)=22\), so the residual is \(21-22=-1\). The residuals, in order, are \(2,-1,-2,-1,2\) response units. They are positive at the low and high ends and negative in the middle, making a U-shaped pattern around zero.

That shape indicates that the straight line has not captured all of the systematic structure in these observations. It is not enough to say “the line fits” merely because it passes through the middle of the data overall. The residual plot shows that its errors change direction across the predictor range. A curved relationship is one possible description of the pattern, but this plot alone does not establish a cause or guarantee which alternative model is appropriate.

Variation Among Cases at the Same Predictor Value

The fitted line assigns the same fitted response to every case with the same predictor value. The observed responses need not be identical. A residual plot can make this especially clear when predictor values repeat: cases at one \(x\) value appear vertically above or below the zero line according to their own residuals. The fit summarizes the line’s response at that \(x\), not every individual response.

Worked Example: Different Responses at the Same Predictor Value

Suppose a hypothetical fitted line relating practice hours \(x\) to a score \(y\) in points is \(\hat{y}=5+2x\). The observations are \((2,6)\), \((2,12)\), \((4,10)\), \((4,16)\), \((6,14)\), and \((6,20)\), where each pair lists \((x,y)\). Calculate fitted values and residuals.

At \(x=2\), the fitted response is \(5+2(2)=9\). The two residuals are \(6-9=-3\) and \(12-9=3\) points.

At \(x=4\), the fitted response is \(5+2(4)=13\). The two residuals are \(10-13=-3\) and \(16-13=3\) points.

At \(x=6\), the fitted response is \(5+2(6)=17\). The two residuals are \(14-17=-3\) and \(20-17=3\) points.

Thus the line gives one fitted score for each predictor value, but the two observed scores at each value differ by 6 points. In the residual plot, each of the three predictor values has one point 3 points below zero and one 3 points above. The line describes the fitted trend; it does not eliminate the observed differences between cases with the same study time.

What Residuals Do—and Do Not—Tell Us

Residual plots matter because a numerical equation can look precise while hiding a poor description of the data’s structure. The plot provides a direct way to ask whether the straight-line summary leaves a recognizable pattern behind. If it does, then the line alone is not an adequate summary of all the observed variation, even if its slope and fitted values have been calculated correctly.

A residual is also not the same as an unobserved model error. The residual is calculated from the sample after estimating the line; it is observable for each case. An error term is a theoretical component in a model, and its value is not directly observed. For the descriptive task here, residuals are the quantities we can calculate and plot.

A patternless residual plot does not prove that the relationship is truly linear or that predictions will be accurate in a new setting. It only indicates that this plot does not show a clear systematic pattern in the observed residuals. Likewise, a visible pattern is evidence about the limitations of the straight-line summary, not proof of why the pattern arose. Context and the quality of the data remain important.

Common Mistake: Treating the Fitted Value as the Actual Response

A frequent error is to report \(\hat{y}_i\) as though it were the observed \(y_i\), or to call a residual “the amount caused by” the predictor. The fitted response is the value on the estimated line. The residual is the signed difference between the observed and fitted responses. Neither statement identifies the cause of a case’s departure from the line.

For instance, if a fitted score is 70 points and an observed score is 66 points, the residual is \(66-70=-4\) points. Correctly, the observed score is 4 points below the fitted score. It would be incorrect to conclude that the predictor caused a four-point loss. The residual is a comparison to the fitted line, not a causal explanation.

Key takeaway: A fitted response is the line’s value at a case’s predictor. A residual is the observed response minus that fitted value. Plotting residuals against the predictor makes it possible to see whether the straight-line trend leaves systematic structure in the observed data.

Check Your Understanding

Use the definitions and interpretation rules above to answer these questions.

  1. A fitted response is 42 units and the observed response is 47 units. What is the residual, and what does its sign mean?
  2. Why do the vertical coordinates in a residual plot have the same units as the response?
  3. What kind of residual pattern would suggest that a straight-line fit has missed systematic structure?
  4. At a repeated predictor value, why can observed responses differ even though their fitted responses are equal?
  5. Why does a patternless residual plot not prove that the relationship is linear in every population or setting?