Why Add a Smooth Curve?
A residual scatterplot displays individual residuals, but a cloud of points can make a gradual pattern difficult to see. A smooth curve drawn through the plot summarizes the local average direction of the residuals. It can help reveal a persistent bend, a gradual rise or fall, or an apparent absence of broad structure.
The curve is a visual aid, not a new set of observed residuals and not a formal test. Its appearance depends on how much smoothing is used. A very flexible curve can follow random ups and downs; a very broad curve can conceal real gradual structure. Interpretation therefore requires looking at both the points and the curve, and considering the smoothing choice.
What the Curve Summarizes
For a simple linear regression, write the model as \(Y_i=\beta_0+\beta_1x_i+\varepsilon_i\), with fitted value \(\hat{y}_i\) and residual \(e_i=y_i-\hat{y}_i\). The standard mean-model assumption is that the errors have conditional mean zero: \(E(\varepsilon_i\mid x_i)=0\). A residual plot places \(e_i\) on the vertical axis and a quantity such as \(\hat{y}_i\) or \(x_i\) on the horizontal axis.
If the fitted mean relationship is suitable, residuals should not show a sustained local rise or fall as the horizontal variable changes. A smooth curve estimates that local direction. A curve above zero indicates that nearby residuals tend to be positive, so observed responses tend to exceed fitted responses in that region. A curve below zero indicates a local tendency for fitted responses to exceed observed responses. A curved or sloping trend may suggest that the mean relationship is not fully captured by the fitted model, but the plot alone does not establish a cause.
A simple version uses equal weights for a fixed number of nearby points; this is a moving average. Common software also uses methods such as LOESS, which fits a low-degree polynomial locally with greater weight given to nearby observations. These methods differ in detail, but the central idea is the same: summarize nearby residuals rather than connect every residual in order.
The amount of smoothing controls how local the summary is. A narrow neighborhood gives individual points more influence and produces a more flexible curve. A broad neighborhood averages over more points and usually produces a smoother, less flexible curve. Software may express this choice as a span, a bandwidth, or a number of neighbors; the exact setting depends on the method.
A Short Justification for Weighted Averages
A weighted average is a natural local summary because it is the constant value that best represents the residuals in a neighborhood under weighted squared error. For fixed nonnegative weights, consider the weighted sum of squared deviations from a proposed local level \(c\):
Differentiate with respect to \(c\) and set the derivative equal to zero:
Rearranging gives \(c\sum_i w_i(z_0)=\sum_i w_i(z_0)e_i\). Provided the total weight is positive, the minimizing value is exactly \(\tilde e(z_0)\). This calculation explains the weighted-average smoother; it does not show that the curve is an unbiased estimate at every point or that a visible departure is statistically significant.
Worked Example: A Moving Average Reveals a Gradual Dip
Suppose a hypothetical linear regression predicts clinic waiting time in minutes. The residual plot uses fitted waiting time on the horizontal axis. At nine equally spaced fitted values, the residuals, in minutes, are \(2, 1, -1, -2, 0, -2, -1, 1, 2\). Calculate a centered three-point moving average at the fitted value of 20 minutes.
The fitted values are 10, 20, 30, and so on, in minutes. The three residuals centered at 20 minutes are \(2, 1,\) and \(-1\) minutes. With equal weights, the local average is
At 40 minutes, the centered residuals are \(-1,-2,\) and \(0\), so the moving average is
At 50 minutes, it is \(\{-2+0+(-2)\}/3=-1.33\) minutes, and at 60 minutes it is \(\{0+(-2)+(-1)\}/3=-1.00\) minute. The local averages turn negative through the middle of the fitted-value range. In context, the observations in that region tend to have shorter waiting times than the model predicts. The pattern may indicate a feature of the mean relationship that a straight line does not capture; the plot does not by itself identify the reason.
How Smoothing Choices Change the Picture
A smoother cannot separate signal from noise with certainty. Its main practical trade-off is between flexibility and stability. A narrow smoother reacts strongly to local changes, which can make genuine structure easier to locate, but it can also trace random variation. A broad smoother suppresses short-term fluctuations, but may flatten a gradual departure or combine distinct parts of the plot into one summary.
The following hypothetical sequence shows the trade-off. Suppose residuals at seven equally spaced fitted values are \(1,-2,2,-2,2,-2,1\) minutes. A centered three-point moving average at the second position is
and at the third position it is
The narrow smoother continues alternating between positive and negative local averages, echoing the rapid changes in the points. A broader five-point average at the third position is \(\{1-2+2-2+2\}/5=0.200\) minutes; at the fourth it is \(\{-2+2-2+2-2\}/5=-0.400\) minutes. It varies less sharply. Neither calculation proves that the narrow curve’s wiggles are meaningful or that the broader curve is preferable. The plotted points and the context must guide the choice.
Worked Example: Choosing a Broader Smoother for Noisy Residuals
A hypothetical analyst sees the seven residuals above and wants to assess whether they show a broad trend rather than a sequence of short alternating fluctuations. The analyst compares the three-point and five-point moving averages rather than selecting a curve only because one looks persuasive.
The three-point averages at the second and third positions are \(0.333\) and \(-0.667\) minutes. Their difference is \(-0.667-0.333=-1.000\) minute, a noticeable change over one position. The five-point averages at the third and fourth positions are \(0.200\) and \(-0.400\) minutes, a difference of \(-0.600\) minute. Averaging more points reduces the size of this particular local swing.
The five-point summary is less responsive to the alternating sequence, so it may be more useful for asking whether there is a gradual, broad pattern. But it also uses a wider region: it can smooth over a real change that occurs over a short range. The responsible conclusion is not that one setting is always correct. It is that the apparent pattern should be checked for sensitivity to a reasonable change in smoothing, while the raw residuals remain visible.
Uneven Spacing and the Ends of a Plot
A moving average based only on the order of points can be misleading when horizontal values are unevenly spaced. Two observations that are adjacent in the data ordering may be far apart on the axis. Distance-based smoothers address this by assigning weights according to distance from the target value. Even then, the ends of the plotted range deserve care: there are observations on only one side of an endpoint, so the local summary can be less stable or behave differently from summaries in the middle.
Worked Example: Distance Weights With Uneven Predictor Values
Consider a hypothetical regression of response time on a continuous predictor \(x\). The observed predictor values are \(1,2,3,4,10\), and the corresponding residuals are \(1,-1,-1,1,0\) response-time units. To illustrate distance weighting near \(x=3\), use the triangular weight rule \(w_i=\max(0,1-|x_i-3|/3)\).
The weights for \(x=1,2,3,4,10\) are respectively \(1/3,2/3,1,2/3,0\). The observation at \(x=10\) receives no weight because it is outside the distance range of 3 units. The weighted residual average at \(x=3\) is therefore
The local average is \(-0.250\) response-time units. It summarizes nearby residuals, not all five residuals equally. An equal-weight moving average over three consecutive entries would treat the gaps from \(x=3\) to \(x=4\) and from \(x=4\) to \(x=10\) alike, even though their lengths are 1 and 6. That is why the horizontal positions, not just the sequence of rows, matter when choosing or interpreting a smoother.
Reading the Curve Responsibly
A smooth curve adds a compact view of local direction, but it does not replace the scatterplot. Residuals are calculated from a fitted model, not observed errors; their in-sample relationships can also be constrained by the fitting procedure. These facts make the curve a diagnostic summary rather than a direct picture of the unobserved errors.
A curve close to zero is evidence that the chosen smoother did not reveal a strong local mean pattern at its chosen degree of flexibility. It is not proof that every model assumption holds. Similarly, a curve that departs from zero is a prompt to inspect the points, the predictor range, and the modeling context, not an automatic instruction to change the model. A smoother does not calculate a p-value or confidence interval, and its visual output should not be described as a formal significance finding.
A useful reading sequence is:
Check where residuals lie relative to zero and whether the points show a broad pattern or only isolated variation.
Describe where it rises, falls, or stays near zero, and translate positive or negative residuals into the response’s units.
Ask whether a modestly narrower or broader curve would change the main visual conclusion.
Report the curve as diagnostic evidence, not as a test result or proof of a particular model failure.
Common Mistakes
- Treating every wiggle as structure. A narrow smoother can follow random point-to-point variation. Check whether the overall pattern persists with a somewhat broader smoother.
- Assuming a flat curve proves the model is correct. A smoother can miss patterns, and a chosen setting may hide them. A near-zero curve is limited visual evidence, not proof.
- Ignoring the residual points. The curve can conceal isolated observations or uneven scatter. Interpret it alongside the actual cloud.
- Calling the curve a significance test. A visible departure from zero is not a p-value. Describe the pattern and its limits rather than claiming a formal rejection.
- Forgetting units and direction. Positive residuals mean observed responses exceed fitted responses; negative residuals mean fitted responses exceed observed responses. State the response units.
Check Your Understanding
Answer each question in context, using the distinction between a visual summary and a formal test.
- In a residual plot, what does a smooth curve below zero over part of the horizontal range indicate about observed and fitted responses there?
- Why can a very narrow smoother make random fluctuations appear important?
- For residuals \(2,-1,1\), calculate their equal-weight moving average.
- Why might a distance-weighted smoother be preferable to a fixed number of adjacent points when predictor values are unevenly spaced?
- Does a smooth curve close to zero prove that the model is appropriate? Explain.
- What should an analyst report if the broad pattern changes substantially when the smoothing span is adjusted?