Tutorials › Regression Analysis (Undergraduate) › Distinguishing Data Errors from Model Misspecification

Specification Checks and Residual Patterns · Tutorial 588 of 991

Distinguishing Data Errors from Model Misspecification

Learn a disciplined way to investigate unusual residuals by checking the data and measurement process before considering changes to the regression mean.

Advanced 10 min read

What You'll Learn

  • Define data errors, measurement problems, and mean-model misspecification
  • Explain why a residual alone cannot identify the cause of a discrepancy
  • Check original records and measurement documentation before revising a model
  • Work through residual evidence for a transcription error, curvature, and a measurement offset
  • Decide when a correction is justified and when a candidate model change merits further evaluation

Why a Residual Pattern Needs an Investigation

An unusual residual is a signal to investigate, not a diagnosis. A point far from a fitted regression line might reflect an incorrectly transcribed outcome, a problem in how the outcome was measured, or a regression mean that does not describe the relationship well. Those explanations call for different actions. Changing the model to accommodate an incorrect record can obscure the actual problem; correcting a valid observation because it does not fit the line can discard important information.

The first question is therefore not “Which extra term should be added?” but “Can the recorded values and their measurement process be verified?” Residual patterns help identify where to look. Source records and measurement documentation help determine what the pattern means.

Definition: For observation \(i\), the residual is \(e_i=y_i-\hat{y}_i\), where \(y_i\) is the recorded outcome and \(\hat{y}_i\) is the fitted value from the regression model. A data error is an incorrect recorded or processed value relative to the intended observation. A measurement problem occurs when the method or instrument does not measure the intended outcome accurately or consistently. Mean-model misspecification occurs when the chosen regression mean does not adequately represent the conditional mean relationship in the population being studied.

What a Residual Can—and Cannot—Tell You

A useful starting point is a regression model for the conditional mean:

$$ Y_i=\mu_i+\varepsilon_i,\qquad \mu_i=f(x_i;\beta) $$

Here \(Y_i\) is the outcome for observation \(i\), \(x_i\) denotes its predictors, \(f(x_i;\beta)\) is the specified mean function, and \(\varepsilon_i\) is the random error. The fitted value \(\hat{y}_i\) estimates that mean using the observed data. For the usual regression diagnostic reasoning, observations should be correctly paired with their predictors, the recorded variables should represent what the analysis intends to study, and the errors should have mean zero conditional on the predictors. Independence and an appropriate variance model also matter for standard errors and inference. A systematic residual pattern may raise a concern about the mean, but it does not by itself establish which assumption or data step is responsible.

This limitation follows directly from the residual definition: \(e_i\) is the difference between a recorded value and a model-based fitted value. The difference contains no label indicating whether the outcome was mistyped, measured with bias, or generated by a mean relationship the model cannot represent. Even a very large residual identifies only a large discrepancy from the fitted value.

For least squares, a residual’s contribution to the residual sum of squares is \(e_i^2\). Thus a single large residual can strongly affect the fit, but its influence is not evidence that the observation should be removed. Residual plots can also reveal patterns across predictor values, groups, or collection order. Earlier work on residual diagnostics uses these patterns to locate possible concerns; the next step here is to investigate their source.

A Source-First Investigation

Before revising a specification, trace the suspect observation or pattern back through the data process. Check the original record, the definition of the outcome, how measurements were obtained, and any documented processing steps. If the source cannot resolve the issue, describe the uncertainty rather than silently choosing the explanation that produces the most convenient fit.

1
Locate the discrepancy.
Record which residuals are unusual and whether they occur for one observation or in a pattern across values, groups, or collection conditions.
2
Verify the observation.
Compare the analysis value with the original record and confirm that it is paired with the correct individual and predictors. Check the intended outcome definition.
3
Review how it was measured.
Check instrument, protocol, timing, and other relevant documentation for a systematic issue that could explain the residual pattern.
4
Reassess the mean only after those checks.
If the values and measurement process are credible, consider whether a systematic pattern suggests the chosen mean function is inadequate. Evaluate a candidate specification in context.
5
Document and refit.
Correct a value only when the correction is supported by its source. Refit using the corrected data, if appropriate, and reassess the diagnostics; do not treat a correction or model change as proof that every other concern is resolved.

Worked Examples

Worked Example: A Discrepancy With a Verifiable Source

Suppose a hypothetical regression model predicts a clinic visit duration of \(42.6\) minutes for one record. The analysis file contains \(426\) minutes. The residual using the file as it stands is

$$ e_i=y_i-\hat{y}_i=426-42.6=383.4\text{ minutes}. $$

That very large positive residual is a reason to inspect the record, not a sufficient reason to delete it or add a model term. The original intake form is then checked and shows \(42.6\) minutes, matching the model’s scale and the recorded predictors. In this hypothetical case, the analysis value does not match the source: the recorded \(426\) is a transcription error.

If the original form is authoritative and the intended outcome is visit duration in minutes, the value can be corrected to \(42.6\) minutes with the correction documented. The residual for this observation relative to the previously fitted model would then be \(42.6-42.6=0\) minutes. Because least-squares estimates depend on the data used to fit them, the model must be refitted before drawing conclusions from the corrected data. A small residual after correction does not, by itself, validate the model for all observations.

Worked Example: A Verified Curved Pattern

Consider a hypothetical set of five verified observations with predictor values \(x=0,1,2,3,4\) and outcomes \(y=2,4,8,14,22\). Suppose a straight-line mean is fitted. The sample means are \(\bar{x}=2\) and \(\bar{y}=10\). The least-squares slope is

$$ b_1=\frac{\sum (x_i-\bar{x})(y_i-\bar{y})}{\sum (x_i-\bar{x})^2} =\frac{50}{10}=5, $$

so the intercept is \(b_0=\bar{y}-b_1\bar{x}=10-(5)(2)=0\), and the fitted line is \(\hat{y}=5x\). The residuals are:

$$ \begin{array}{c|ccccc} x_i & 0 & 1 & 2 & 3 & 4\\ y_i & 2 & 4 & 8 & 14 & 22\\ \hat{y}_i & 0 & 5 & 10 & 15 & 20\\ e_i & 2 & -1 & -2 & -1 & 2 \end{array} $$

The residuals are positive at both ends and negative in the middle, a curved pattern rather than one isolated discrepancy. In this example the original records have been checked, and the same outcome definition and measurement procedure were used throughout. That evidence makes a data-entry explanation less plausible and motivates considering whether the straight-line mean is inadequate.

Indeed, these particular outcomes satisfy \(y=x^2+x+2\), so that quadratic mean gives fitted values \(2,4,8,14,22\) and residuals all equal to zero. This arithmetic illustrates a possible mean-model explanation for the pattern; it does not establish that a quadratic model is appropriate in another data set, nor does an exact fit to five observations establish a general relationship. The important diagnostic point is that verified systematic curvature differs from a single source-confirmed incorrect value.

Worked Example: A Pattern Linked to Measurement Method

In a hypothetical data set, residuals from the same fitted regression model are grouped by measuring device. Four measurements made with Device A have residuals \(-1,0,1,0\) units, while four made with Device B have residuals \(4,5,6,5\) units. The group means are

$$ \bar{e}_A=\frac{-1+0+1+0}{4}=0,\qquad \bar{e}_B=\frac{4+5+6+5}{4}=5\text{ units}. $$

The positive residuals for Device B indicate that its measured outcomes tend to exceed the model’s fitted values. The residuals alone do not show whether Device B has a calibration problem or whether the groups genuinely differ in a way the model does not represent.

Suppose the device logs are checked and show that, during the relevant period, Device B had a documented calibration offset of \(+5\) units. That source information supports a measurement explanation: the residual grouping corresponds to a known feature of the measurement process. Any correction must follow the documented calibration and the study’s outcome definition; the group mean of five is not by itself a universal correction rule. If the logs instead showed no measurement issue, the group pattern would remain a reason to investigate whether the model mean omits a relevant group difference. The evidence distinguishes these possibilities more reliably than adding a device indicator solely because its residuals have a different average.

Deciding What to Do With the Evidence

The goal is not to force every residual pattern into either “bad data” or “bad model.” Some observations may be uncertain, and some patterns may have more than one plausible explanation. A source-confirmed error supports a documented correction. A credible measurement concern may require qualification, sensitivity analysis, or further investigation, depending on whether the intended outcome can be recovered. A consistent pattern remaining in verified data can support evaluating a different mean structure.

Evidence after checking sourcesReasonable next stepWhat not to conclude
Recorded value conflicts with an authoritative sourceCorrect it transparently if the intended value is clear, then refitThat every large residual is an error
Residuals align with a documented measurement problemEstablish what the procedure implies for the intended outcomeThat adding a predictor automatically repairs measurement bias
Records and measurements are credible, with a systematic residual patternConsider and evaluate a contextually justified mean-model changeThat a pattern proves one particular alternative model

A common mistake is to say, “This observation has a large residual, so it must be an outlier caused by a bad record; I will remove it.” The reasoning confuses the size of a model discrepancy with evidence about its cause. The correction is to verify the record and measurement process first, retain valid observations, and make any data correction or model revision for a documented reason. A point can be unusual and valid, and a residual pattern can arise even when every value was recorded accurately.

Key takeaway: A residual locates a difference between recorded outcomes and fitted values; it does not identify why the difference exists. Verify records and measurement processes before changing the regression mean, and reassess the fit after any justified correction.

Check Your Understanding

Use the source-first reasoning in each case.

  1. Why does a large residual, by itself, fail to show that a recorded outcome is incorrect?
  2. A residual pattern curves across verified predictor values. What should be checked before considering a different mean function?
  3. Residuals are systematically higher for one measuring device. Name two distinct explanations that should be investigated before changing the model.
  4. If a source document confirms a transcription error, why should the regression model be refitted after correcting the value?
  5. What is the difference between a documented measurement problem and evidence that the regression mean is misspecified?