From a Diagnostic Pattern to a Defensible Action
A regression diagnostic is a prompt to investigate, not an instruction to change the model in a predetermined way. A curved residual pattern points toward a possible problem with the mean function; a fan-shaped pattern points toward changing error variance; and one unusually large residual may reflect a data mistake, an unusual but valid case, or a model that fits part of the population poorly. Those situations call for different follow-up actions.
The objective is not to make every diagnostic plot look neat by trying modifications until the pattern disappears. It is to identify a plausible cause, choose an action that addresses that cause, and then examine whether the revised analysis is appropriate for the question. In particular, a high residual or influential observation is not, by itself, a reason to delete a case.
The appropriate response depends on what the pattern suggests. A systematic curve in residuals versus the predictor or fitted values suggests that a straight-line conditional mean may be inadequate. A spread that grows or shrinks with fitted values suggests nonconstant variance. A single striking case calls for checking its data and context, as well as its influence on the fitted model. These are clues, not automatic conclusions.
| Diagnostic clue | Reasonable follow-up | What not to assume |
|---|---|---|
| Ordered curvature in residuals | Consider adding a scientifically plausible nonlinear term, such as \(x^2\). | That every curve will be fixed by a quadratic term. |
| Increasing or decreasing residual spread | Investigate the response scale and the variance pattern; consider a transformation or weighted least squares if justified. | That changing the model mean alone fixes changing variance. |
| One unusually large or influential case | Verify the record and investigate why the case differs; compare justified analyses with and without it. | That unusual means erroneous, or that deletion is harmless. |
| Pattern without a clear explanation | Review data collection, measurement, and model purpose before choosing a modification. | That the first modification that removes a visible pattern is necessarily suitable. |
When a Straight-Line Mean Is Inadequate
If residuals show a systematic curve as \(x\) changes, the fitted straight line may be missing structure in the conditional mean. One possible follow-up is a quadratic mean model, \(E[Y_i\mid x_i]=\beta_0+\beta_1x_i+\beta_2x_i^2\). This is still a linear regression model in its coefficients: the predictors are now \(x_i\) and \(x_i^2\). A quadratic term is plausible when the pattern and subject matter support a bend over the observed range. It should not be used to justify extrapolation far beyond that range.
The justification follows directly from least squares. Let \(e_i=y_i-\hat y_i\) be residuals from the straight-line fit and let \(q_i=x_i^2\). If we add \(c q_i\) to the fitted values while holding the other fitted components fixed, the sum of squared residuals becomes \(\sum_i(e_i-cq_i)^2\). Expanding gives \(\sum_i e_i^2-2c\sum_i e_iq_i+c^2\sum_iq_i^2\). When \(\sum_i e_iq_i\ne0\) and \(\sum_iq_i^2>0\), choosing \(c=(\sum_i e_iq_i)/(\sum_iq_i^2)\) reduces the sum of squares relative to \(c=0\). This explains how a quadratic term can absorb a residual association with \(x^2\); it does not, by itself, establish that the new model is useful or appropriate.
Worked Example: Following Up a Curved Residual Pattern
A hypothetical process analyst records a response \(Y\) at five standardized operating settings \(x=-2,-1,0,1,2\). The responses are \(10,9,10,13,18\), respectively. Residuals from a straight-line fit are positive at both ends and negative near the center. Calculate that fit and show the quadratic follow-up.
Method. First calculate the OLS line, then fit a quadratic using the same observations. The data are illustrative; the purpose is to identify what the added term does, not to claim that five observations establish a general model.
The means are \(\bar x=0\) and \(\bar y=(10+9+10+13+18)/5=12\). Also, \(\sum x_i^2=4+1+0+1+4=10\), and \(\sum x_iy_i=(-2)(10)+(-1)(9)+(0)(10)+(1)(13)+(2)(18)=20\). Thus the slope is \(20/10=2\), and the intercept is \(12-2(0)=12\). The fitted line is \(\hat y=12+2x\).
At the five settings, the fitted values are \(8,10,12,14,16\). The residuals, observed minus fitted, are therefore \(2,-1,-2,-1,2\). Their positive ends and negative middle show the stated curvature pattern.
For the quadratic fit, write \(\hat y=b_0+b_1x+b_2x^2\). The symmetry of the \(x\)-values gives \(\sum x_i=0\) and \(\sum x_i^3=0\), so the estimate of \(b_1\) is \(\sum x_iy_i/\sum x_i^2=2\). The mean of \(x^2\) is \(2\), and the centered \(x^2\) values are \(2,-1,-2,-1,2\). Their squared sum is \(4+1+4+1+4=14\). Their product sum with \(y\) is \(2(10)-1(9)-2(10)-1(13)+2(18)=14\). Therefore \(b_2=14/14=1\), and \(b_0=\bar y-b_2\overline{x^2}=12-2=10\). The quadratic fit is \(\hat y=10+2x+x^2\).
Substitution gives fitted values \(10,9,10,13,18\), so all five residuals are zero. This exact fit is a consequence of the constructed data and is not evidence that real data should be modeled this way. Common mistake avoided: assuming that the curved residual pattern proves a quadratic relationship. The pattern motivates a plausible follow-up; subject-matter reasoning and diagnostics for the revised model still matter.
When the Response Scale May Be the Issue
A transformation of the response can be useful when the original scale makes the relationship or error spread difficult to describe. For example, a positive response that grows multiplicatively with \(x\) may be more nearly linear on a logarithmic scale. If the fitted model is \(\log(Y_i)=\beta_0+\beta_1x_i+\varepsilon_i\), then a one-unit increase in \(x\) multiplies the modeled geometric scale by \(e^{\beta_1}\), rather than adding \(\beta_1\) units to the response.
This changes the question being modeled: the response is now \(\log(Y)\), and predictions on that scale are not automatically arithmetic-mean predictions on the original scale. Exponentiating a fitted log response gives a prediction on a multiplicative or geometric scale. If the goal is the arithmetic mean of \(Y\), additional assumptions about the error distribution are needed to obtain an appropriate correction. A logarithm also requires positive response values. It is not a general remedy for every pattern.
Worked Example: Checking a Logarithmic Response Model
A hypothetical analyst measures a positive response at \(x=0,1,2,3\), obtaining \(Y=10,20,40,80\). An original-scale straight-line fit has visibly larger residual magnitudes toward the higher responses. Calculate both fits and interpret the log-scale result.
Method. Calculate the original-scale line using OLS, then fit a line to \(\log(Y)\), using natural logarithms. The exact doubling in these illustrative values makes the log-scale calculation transparent.
For the original-scale fit, \(\bar x=(0+1+2+3)/4=1.5\) and \(\bar y=(10+20+40+80)/4=37.5\). The numerator for the slope is \((-1.5)(-27.5)+(-0.5)(-17.5)+(0.5)(2.5)+(1.5)(42.5)=115\). The denominator is \(2.25+0.25+0.25+2.25=5\), so the slope is \(115/5=23\). The intercept is \(37.5-23(1.5)=3\). The fitted values are \(3,26,49,72\), and the residuals are \(7,-6,-9,8\).
For the transformed fit, the log responses are \(\log(10)=2.3026\), \(\log(20)=2.9957\), \(\log(40)=3.6889\), and \(\log(80)=4.3820\), rounded here to four decimal places. Each step in \(x\) increases \(\log(Y)\) by \(\log(2)=0.6931\). The fitted log-scale line is therefore \(\widehat{\log(Y)}=2.3026+0.6931x\), with fitted log responses \(2.3026,2.9957,3.6889,4.3820\). Exponentiating these gives \(10,20,40,80\), to the displayed precision.
The log fit describes constant multiplicative growth in this constructed example, while the original-scale residuals have much larger magnitudes at high responses. In real data, one must check whether the transformation addresses the relevant pattern and whether its interpretation suits the analysis. Common mistake avoided: treating an exponentiated log-scale prediction as automatically equal to the conditional arithmetic mean of \(Y\).
When Unequal Variance Suggests Weighted Least Squares
A pattern in which residual spread changes across the predictor range concerns the error variance, not necessarily the conditional mean. If the mean model is reasonable and the error variances differ in a known or defensibly modeled way, weighted least squares (WLS) can give greater weight to observations with more precise responses. If \(\operatorname{Var}(\varepsilon_i\mid x_i)=\sigma^2_i\), the inverse-variance weight is \(w_i=1/\sigma_i^2\). Multiplying all weights by the same positive constant leaves the coefficient estimates unchanged.
Worked Example: Calculating a Weighted Least-Squares Line
A hypothetical calibration study has two observations at each of \(x=0\) and \(x=1\). At \(x=0\), the responses are \(1\) and \(3\), each with error variance \(4\). At \(x=1\), they are \(2\) and \(4\), each with error variance \(1\). Calculate the WLS line using inverse-variance weights.
Method. Assign weight \(1/4\) to each observation at \(x=0\) and weight \(1\) to each at \(x=1\). Multiplying all weights by four gives equivalent weights \(1,1,4,4\), which simplify the arithmetic.
For these equivalent weights, \(\sum w_i=10\), \(\sum w_ix_i=8\), \(\sum w_iy_i=1(1)+1(3)+4(2)+4(4)=28\), \(\sum w_ix_i^2=8\), and \(\sum w_ix_iy_i=4(2)+4(4)=24\). The weighted normal equations are \(10b_0+8b_1=28\) and \(8b_0+8b_1=24\).
Subtracting the second equation from the first gives \(2b_0=4\), so \(b_0=2\). Substitution into \(8b_0+8b_1=24\) gives \(16+8b_1=24\), hence \(b_1=1\). The WLS line is \(\hat y=2+x\).
The residuals are \(-1,1,-1,1\), in the order of the observations. The weighted sum of squared residuals is \(1(1)+1(1)+4(1)+4(1)=10\); with the original inverse-variance weights it is \(10/4=2.5\). The coefficient line is the same under either common scaling of the weights. Common mistake avoided: giving the noisier \(x=0\) observations greater weight. Inverse-variance weighting gives less weight to the observations with variance \(4\).
When a Case Looks Unusual
An unusual residual, high leverage, or large influence statistic identifies a case for attention, not automatic removal. First check whether the value was transcribed, measured, coded, or joined to the wrong record. If an error is confirmed, correct it from a reliable source or exclude the record only when it cannot be recovered and the exclusion is documented. If the value is valid, investigate whether it belongs to the target population and whether it reveals a limitation in the model. A legitimate observation should not be discarded merely because its removal improves the fit.
Worked Example: Auditing a Suspected Data Error
A hypothetical equipment study records response \(Y\) at settings \(x=1,2,3,4\), with values \(14,16,18,20\). A fifth record at \(x=5\) contains \(Y=220\), producing a very large residual against the pattern in the first four cases. The original measurement log is checked and confirms that the fifth response was \(22\), not \(220\). Show the justified correction and resulting fit.
Method. Verify the source record before changing the analysis. Here the log establishes a transcription error, so the recorded value is corrected to \(22\); this is not a discretionary deletion of an inconvenient valid case.
Using all five corrected observations, \(\bar x=(1+2+3+4+5)/5=3\) and \(\bar y=(14+16+18+20+22)/5=18\). The slope numerator is \((-2)(-4)+(-1)(-2)+(0)(0)+(1)(2)+(2)(4)=20\). The denominator is \(4+1+0+1+4=10\). Thus the slope is \(20/10=2\), and the intercept is \(18-2(3)=12\). The corrected-data line is \(\hat y=12+2x\).
Its fitted values at \(x=1,2,3,4,5\) are \(14,16,18,20,22\), so each residual is zero. The incorrect value \(220\) would have a residual of \(220-22=198\) relative to this line. The source record, rather than that large residual alone, justifies the correction. Common mistake avoided: deleting the fifth case because it is influential without checking whether it is valid.
Common Traps When Choosing a Follow-Up
- Using a mean adjustment for a variance pattern. A quadratic term changes the modeled conditional mean; it does not automatically correct nonconstant error variance.
- Transforming only to make a plot look better. A transformed response changes the scale and interpretation. Confirm that it is meaningful for the question and that its domain requirements are met.
- Assuming WLS weights are known from the plot. Inverse-variance weights require a defensible variance model. Arbitrary weights can change the fit without addressing the underlying problem.
- Deleting an influential case automatically. Influence describes how much a case affects the fitted analysis, not whether the case is erroneous or irrelevant.
- Accepting a more complex fit solely because its residual sum of squares decreases. Adding predictors cannot increase the ordinary least-squares residual sum of squares on the same observations, so that decrease alone does not establish that the added structure is useful.
A defensible response links the observed pattern to a plausible cause and preserves the purpose of the analysis. State what evidence motivated the action, what changed in the model or data, and how the result is interpreted afterward. If the cause remains uncertain, report that uncertainty rather than presenting one modification as a proven remedy.
Check Your Understanding
For each scenario, choose a reasonable first response and distinguish it from an automatic conclusion.
- A residual plot against \(x\) has a smooth U-shaped pattern across the observed range. What model modification could be considered, and what would the pattern not prove? (Answer: Consider adding a scientifically plausible \(x^2\) term; the pattern alone does not prove the true mean is quadratic.)
- A positive response has residual spread that grows with its fitted value, while the mean pattern appears approximately straight on a log scale. What follow-up is reasonable, and what prediction interpretation requires care? (Answer: Consider modeling \(\log(Y)\) and reassess diagnostics; exponentiated predictions are not automatically arithmetic conditional means.)
- Independent process information supports error variances of \(9\) and \(1\) for two groups of observations. What is the ratio of their inverse-variance weights, group 1 to group 2? (Answer: \(1/9:1\), or \(1:9\).)
- A record has an extreme residual and a large influence measure, but its value is plausible. What should be checked before deciding whether to retain it? (Answer: Verify the measurement and record, investigate its population and context, and assess the model’s sensitivity; do not delete it solely for being influential.)
- A source document confirms that a response entered as \(560\) should have been \(56\). Is correcting this value equivalent to deleting a valid influential observation? (Answer: No. Correcting a verified transcription error is a data correction; document the source and retain the case with its verified value when appropriate.)