Why the Ends of the Predictor Range Need Attention
A regression line can describe the broad pattern in a data set while missing a systematic feature near its smallest or largest predictor values. Such a feature can be easy to overlook: most observations may lie in the middle of the range, so a residual plot dominated by those observations can appear unremarkable. Yet a model used to describe or predict outcomes near an endpoint may be especially sensitive to this local mismatch.
The endpoints also require care because they are the limits of the observed evidence. A model repair may improve its description of the data up to the largest observed predictor value, but that improvement does not establish what happens beyond it. The task here is to diagnose patterns at the edges of the observed range, while keeping the limits of that diagnosis clear.
What a Boundary Residual Can Tell You
For a simple linear regression, write the model as \(Y_i=\beta_0+\beta_1x_i+\varepsilon_i\). The fitted value for observation \(i\) is \(\hat y_i=\hat\beta_0+\hat\beta_1x_i\), and its residual is \(e_i=y_i-\hat y_i\). A positive residual means the observed response is above the fitted value; a negative residual means it is below.
A residual pattern near an endpoint is a reason to inspect the model and data more closely, not proof by itself that a particular term is missing. The diagnostic relies on a meaningful response and predictor, correctly paired observations, and a correctly implemented fit. In particular, errors should have conditional mean zero under the proposed mean relationship: \(E(\varepsilon_i\mid x_i)=0\). For the usual regression model, observations are also independent and the errors have constant conditional variance. A visible trend in residuals may suggest the proposed mean relationship is inadequate; changing spread instead raises a different concern. Neither should be confused with an isolated large residual.
First identify the observed range and the density of observations near each end. Then inspect residuals against the predictor, paying attention to direction, order, and how many observations support the apparent pattern. A few isolated points at the edge offer less evidence about a repeated local feature than several neighboring observations that show a consistent direction. Also inspect the fitted relationship alongside the data: a residual pattern may be easier to understand in the response’s original units.
Boundary patterns can be subtle because a fitted line is estimated using the observations being examined. In ordinary least squares with an intercept, the residuals sum to zero, so positive residuals somewhere must be balanced by negative residuals elsewhere. This global balancing does not rule out a local trend: the middle of the predictor range can offset a pattern near an endpoint.
Worked Example: A Curved Pattern at Both Boundaries
Suppose a hypothetical data set has predictor values \(x=0,1,\ldots,6\). A fitted linear regression gives \(\hat y=20+2x\), with the following observed responses. All values are in response units.
| \(x\) | \(y\) | \(\hat y=20+2x\) | \(e=y-\hat y\) |
|---|---|---|---|
| 0 | 25 | 20 | 5 |
| 1 | 22 | 22 | 0 |
| 2 | 21 | 24 | -3 |
| 3 | 22 | 26 | -4 |
| 4 | 25 | 28 | -3 |
| 5 | 30 | 30 | 0 |
| 6 | 37 | 32 | 5 |
For this small example, the endpoints are \(x=0\) and \(x=6\). The residuals at the two endpoint observations are both \(5\), while residuals in the middle are negative. Looking at the two nearest observations at each end, the left boundary mean is \((5+0)/2=2.5\), and the right boundary mean is \((0+5)/2=2.5\). The mean for the three interior observations is \((-3-4-3)/3=-10/3\approx-3.333\).
Thus, the residuals are above the line at both ends and below it in the middle: a curved pattern, not a steady increase or decrease across the full range. The proposed linear fit does satisfy the ordinary least-squares balancing conditions: the residuals sum to \(5+0-3-4-3+0+5=0\), and their predictor-centered weighted sum is \( (-3)(5)+(-2)(0)+(-1)(-3)+0(-4)+1(-3)+2(0)+3(5)=0\). Those global conditions coexist with the clear local pattern. They do not make the linear mean relationship adequate.
Because this is a hypothetical example with only seven predictor settings, it is a clue to investigate curvature, not a basis for generalizing beyond \(0\leq x\leq6\). In a larger data set, one would also check whether the apparent shape is supported by enough observations near each end.
Separate a Repeated Boundary Pattern from an Isolated Point
The number, location, and arrangement of observations matter. A single positive residual at the largest predictor value is an unusual observation to examine, but it does not by itself establish a boundary trend. A run of positive residuals as \(x\) approaches the maximum is more suggestive of a systematic local mismatch. Likewise, alternating signs without an ordered trend may have a different interpretation from several neighboring residuals lying on the same side of zero.
The scale of residuals matters too. If their spread increases toward an endpoint, the main feature may be unequal variability rather than a change in the mean relationship. Earlier material on separating mean-pattern errors from unequal spread provides the relevant distinction. A useful check is to ask whether the signs and centers of residuals change near the boundary, whether their spread changes, or whether both occur.
The endpoints may also have sparse support. If the final part of the predictor range contains only one or two observations, the apparent boundary behavior can depend heavily on those points. In that situation, report the limited support and avoid describing a precise local trend. With several observations clustered at an endpoint, repeated residual direction is more informative, although it still warrants checking data quality and the model’s intended use.
Worked Example: Investigating Positive Residuals Near the Upper Endpoint
In a hypothetical regression with 36 observations, the predictor ranges from 10 to 50 units. The three observations closest to the upper endpoint have predictor values 46, 48, and 50 units, and residuals 3.1, 4.0, and 4.5 response units. The residual plot for the lower and middle portions shows no comparably clear run in one direction.
The mean residual for the three uppermost observations is
Each of the three residuals is positive, so these observed responses are all above their fitted values. The repeated sign and positive mean make the upper boundary worth investigating. They do not show that the fitted model is wrong in a particular way, and they do not constitute a significance test. Other residuals in a fitted model with an intercept must balance their sum; this global constraint does not erase the upper-end pattern.
A sensible next check is whether the three observations share a data-processing issue, a measurement condition, or a meaningful feature not represented in the proposed model. Also verify that the response and predictor units and coding are correct. If the pattern remains plausible after these checks, it can motivate consideration of a different mean relationship, with attention to how well that alternative is supported across the observed range. Three observations at the endpoint do not, on their own, tell us how the response behaves above 50 units.
Model Repairs Must Stay Within the Evidence
When residuals near a boundary show a systematic pattern, a revised mean relationship may describe the observed data better. A quadratic term is one possible candidate when the residual pattern suggests curvature, but the diagnostic does not dictate that choice. Subject-matter reasoning, the full residual pattern, and the intended use of the model all matter. Earlier material on comparing specifications and testing added model terms addresses formal comparisons; a boundary pattern alone should not be treated as an automatic instruction to add terms.
Even a successful repair addresses fit where observations are available. Extrapolation means using a fitted relationship at predictor values outside the observed range. There are no observations there against which to check whether the repaired relationship remains suitable. A polynomial term can make predictions change rapidly outside the data, even when its fit within the observed range appears excellent.
Worked Example: An In-Range Repair Does Not Validate an Extrapolation
Return to the hypothetical data with \(x=0,1,\ldots,6\) and responses \(25,22,21,22,25,30,37\). The linear fit was \(\hat y=20+2x\), with positive residuals at both ends and negative residuals in the middle. Consider instead the quadratic relationship
At \(x=0\), this gives 25; at \(x=1\), it gives 22; at \(x=2\), it gives 21; at \(x=3\), it gives 22; at \(x=4\), it gives 25; at \(x=5\), it gives 30; and at \(x=6\), it gives 37. It therefore reproduces every response in this constructed example, removing the in-range residual pattern.
At \(x=8\), however, this quadratic predicts \(8^2-4(8)+25=64-32+25=57\), while the linear fit predicts \(20+2(8)=36\). The observed predictor range ends at 6, so neither prediction at 8 can be checked against these data. The exact in-range match shows that the quadratic describes this constructed data set; it does not show that the quadratic is the true relationship beyond the observed range. In applied data, even a noticeably improved in-range fit would not establish that claim.
A Practical Boundary Check
A disciplined inspection helps keep a visible endpoint feature in proportion. Use the following sequence as a diagnostic, not as a mechanical rule for changing the model.
Identify the smallest and largest observed predictor values, and note whether there are several observations close to each endpoint or only a few.
Look for a repeated sign, a run, or a systematic change in residuals as observations approach an endpoint. Separate that from one isolated residual.
Consider whether the feature could reflect a coding, unit, measurement, or other data problem, and whether residual spread changes as well as residual direction.
State which observed boundary shows the pattern and how much data support it. Treat any model revision as a candidate for assessment within the observed range, not as evidence about values beyond it.
For multiple predictors, “near a boundary” requires extra care. An observation can be near the minimum or maximum of one predictor while still lying in a well-populated part of the joint predictor combinations—or it can occupy an unusual combination of several predictors. A one-predictor edge check does not fully describe that multivariable support. Keep any boundary claim tied to the predictor or combination actually examined.
Common Mistakes
- Treating one endpoint residual as proof of a trend. One observation can be unusual for many reasons. Look for a repeated pattern and check the data before assigning a model explanation.
- Calling any large residual a mean-pattern problem. A large residual may be isolated, while a change in residual spread can point to unequal variability. Examine direction, ordering, and spread separately.
- Assuming residuals must look pattern-free because they sum to zero. The zero-sum condition is global. Positive residuals near an endpoint can be balanced by negative residuals elsewhere, as the first example shows.
- Interpreting a better in-range fit as support for extrapolation. A repair can address a pattern among observed cases without establishing how the relationship continues beyond the observed predictor range.
Check Your Understanding
Try these questions without looking back.
- In a fitted regression, residuals are mostly positive near the smallest observed predictor values and mostly negative in the middle. What feature of the fit might this suggest, and why is it not conclusive by itself?
- Three residuals nearest the maximum predictor value are 2, 3, and 4 response units. Calculate their mean and state what it describes.
- Why does the zero-sum property of ordinary least-squares residuals with an intercept not rule out a boundary pattern?
- A quadratic model reduces a residual pattern within the observed predictor range. What additional conclusion about predictions beyond that range is justified?
- How would your interpretation differ if residuals near the upper endpoint had increasing spread but no consistent positive or negative direction?