EconometricsEconometrics Mini-Lecture

What Are Residuals Used for in Empirical Research? — From Model Validation to Special Problem Analysis

You run your regression, glance at the R², coefficients, p-values, and significance stars—then copy the results table into your paper and close Stata.

作者:Econometrics Research Navigation Station发布:2026-07-29★★

1. Introduction: After the Regression, You Stared at the Coefficient Table for Ten Minutes—But Have You Looked at the Residuals?

You run your regression, glance at the R², coefficients, p-values, and significance stars—then copy the results table into your paper and close Stata.

You skipped the most important diagnostic step: examining the residuals.

The residual ei=YiY^ie_i = Y_i - \hat{Y}_i is the gap between the actual observed value and the model's predicted value. Most people treat it as a "byproduct" of regression—a disturbance term that simply needs to be minimized. But in reality, residuals are the most honest source of information in regression analysis. Coefficients tell you "what the average relationship between X and Y is"; residuals tell you "where this average relationship breaks down, where it is distorted, and where a single data point is single-handedly overturning your entire conclusion."

Core message: Residuals are the "conversation record" between the model and the data. Each residual tells you: how well is this data point explained by the model? Does the model omit important nonlinearities or interaction terms? Is the error variance homogeneous—or does the model systematically deviate from reality in certain regions? Coefficients and R² tell you the model's "average performance"; residuals tell you the model's "blind spots"—those unsettling signals that averages conceal. Running a regression without examining residuals is like taking off without looking at the instrument panel.


2. What Are Residuals? — Not Just "Prediction Errors"

2.1 True Errors vs. Observed Residuals — A Key Distinction

Yi=β0+β1Xi+εi(true model)Y_i = \beta_0 + \beta_1 X_i + \varepsilon_i \quad \text{(true model)} Yi=β^0+β^1Xi+ei(estimated model)Y_i = \hat{\beta}_0 + \hat{\beta}_1 X_i + e_i \quad \text{(estimated model)}

  • True error εᵢ: You never observe it. It is the vertical distance between the true Y and the true regression line.
  • Observed residual eᵢ: You can compute it. It is the vertical distance between the observed Y and your estimated regression line.

Residual ≠ error. Residuals are the "estimated version" of the errors—they are constrained by your model specification. If your model is wrong (e.g., omitting X²), the residuals contain not only noise but also a systematic component arising from model misspecification. This is precisely the starting point of residual analysis—you infer whether the model is misspecified by examining "patterns" in the residuals.

2.2 Basic Properties of Residuals

Under the OLS framework, residuals always satisfy the following properties:

  • ∑eᵢ = 0 — The residuals sum to zero (as long as the model includes an intercept).
  • ∑Xᵢeᵢ = 0 — The sample covariance between the residuals and each independent variable is zero. This is a direct consequence of the OLS first-order conditions.
  • ē = 0 — The mean of the residuals is zero.

These properties are algebraic consequences of OLS—they always hold, regardless of whether the model's assumptions are satisfied. Precisely because these properties always hold, they cannot be used to test model assumptions.


3. Using Residuals to Validate Model Assumptions — Four Major Diagnostics

Among the classical OLS assumptions (exogeneity, homoskedasticity, no autocorrelation, normality), three can be indirectly tested through residuals.

3.1 Testing Homoskedasticity — Scatter Plot of Residuals vs. Fitted Values

Assumption: Var(εiXi)=σ2\text{Var}(\varepsilon_i \mid X_i) = \sigma^2 (the error variance is constant and does not vary with X or Y^\hat{Y}).

Diagnostic tool: rvfplot (Residuals vs Fitted Values Plot).

reg y x1 x2 x3
rvfplot, yline(0)

The vertical axis is the residual eie_i, and the horizontal axis is the fitted value Y^i\hat{Y}_i.

Typical picture of a healthy model: Residuals are scattered randomly and uniformly around the zero line, with no obvious "fan shape," "cone shape," or "funnel shape"—that is, the spread of residuals is roughly the same across the entire range of Y^\hat{Y}.

Typical pictures of heteroskedasticity:

  • Fan shape (opening to the right): Residuals spread out as Y^\hat{Y} increases → Var(ε) increases with Y. Commonly seen in right-skewed data such as income or firm size.
  • Spindle shape (wide in the middle, narrow at both ends): Residuals are large in the middle of Y^\hat{Y} and small at both ends.
  • Systematic arc or curvature: May indicate omitted nonlinear terms or interaction terms—this is more serious than heteroskedasticity; it is a model specification error.

Formal tests:

  • Breusch-Pagan test: estat hettest. H₀: homoskedasticity. p < 0.05 → reject homoskedasticity → heteroskedasticity exists.
  • White test: estat imtest, white. More general than BP (does not assume a specific form of heteroskedasticity), but has lower power in small samples.

If heteroskedasticity is detected: Use robust standard errors (reg y x, robust)—this does not change the coefficient estimates, only corrects the standard errors and inference.

3.2 Testing Normality — The Distributional Shape of Residuals

Assumption: εN(0,σ2)\varepsilon \sim N(0, \sigma^2) (errors follow a normal distribution).

Note: In large samples (n → ∞), by the central limit theorem, OLS estimators are asymptotically normal—even if the errors are not normally distributed, t-tests and F-tests remain approximately valid in large samples. The normality assumption is critical only in small samples.

Diagnostic tools:

(a) Kernel density plot with normal reference line:

reg y x1 x2 x3
predict e, residual
kdensity e, normal

(b) Q-Q plot (quantile-quantile plot):

qnorm e

Healthy model: points on the Q-Q plot lie roughly along the 45-degree reference line. Deviations from the reference line → the error distribution deviates from normality. Common deviation patterns:

  • Upper end curving upward → right-skewed (heavy tail on the right)
  • Lower end bending downward → left-skewed (heavy tail on the left)
  • S-shaped deviation → heavy-tailed distribution (more extreme values than a normal distribution)

(c) Formal tests:

  • Shapiro-Wilk test: swilk e. H₀: residuals follow a normal distribution. p < 0.05 → reject normality. But it is very sensitive in large samples—with n > 5000, it almost always rejects.
  • Skewness-kurtosis joint test: sktest e. Tests separately whether skewness = 0 and kurtosis = 3 (the standard values for a normal distribution).

Practical advice: n > 100 → mild non-normality is usually not a problem. n < 50 with extreme skewness or kurtosis → cause for concern. In this case, consider bootstrap standard errors or methods that do not rely on the normality assumption (e.g., quantile regression).

3.3 Model Specification Tests — "Patterns" in Residuals Are Signals of Model Errors

If residuals contain systematic patterns (rather than just random noise), this means your model omits important variables, functional forms, or interaction terms. This is the most critical—yet most easily overlooked—step in residual analysis.

(a) Scatter plots of residuals vs. each independent variable:

reg y x1 x2 x3
predict e, residual
scatter e x1, yline(0) || lowess e x1, bw(0.5)

If the lowess smoothing line clearly deviates from the zero horizontal line → there is a systematic relationship between X₁ and Y not captured by the model's linear form. Common patterns:

  • U-shaped or inverted U-shaped deviation → X₁'s squared term is omitted.
  • Monotonically increasing or decreasing deviation trend → X₁ and Y have an additional linear component beyond the estimated linear model (possibly due to measurement error or uncontrolled correlated variables).

(b) Ramsey RESET test (general model specification test):

reg y x1 x2 x3
estat ovtest

The RESET test adds higher-order fitted-value terms such as Y^2\hat{Y}^2 and Y^3\hat{Y}^3 to the original model and tests whether their coefficients are jointly significant. If significant → the original model omits nonlinear or interaction effects. H₀: the model is correctly specified (no omitted nonlinearity).

If RESET is significant: First examine scatter plots of residuals against each independent variable to identify which variable produces the "curvature," then consider adding squared terms, interaction terms, or using more flexible functional forms.

(c) Residuals vs. important candidate variables not included in the model:

If you suspect an omitted variable Z, plot e against Z. If a clear correlation exists → Z has systematic explanatory power for Y, and leaving it in the error term will cause bias (if Z is correlated with the controlled X's).

3.4 Outlier and Influential Point Diagnostics — A Single Data Point Can "Hijack" Your Entire Regression Line

(a) Outlier: An unusual Y value—the absolute value of the residual is particularly large. This point has an "unexpected" Y given its X.

(b) High leverage point: An unusual X value—this point's X deviates extremely from the sample mean of X. It has a disproportionate influence on the regression line fitting—because OLS is very sensitive to points far from the center.

(c) Influential point: Both an outlier and a high leverage point—removing it substantially changes the slope of the regression line.

Diagnostic tools:

Studentized residuals: ri=eiσ^(i)1hiir_i = \frac{e_i}{\hat{\sigma}_{(i)} \sqrt{1 - h_{ii}}}

where σ^(i)\hat{\sigma}_{(i)} is the estimated residual standard deviation after deleting the i-th observation, and hiih_{ii} is the leverage value of the i-th observation. Studentized residuals approximately follow a tnk2t_{n-k-2} distribution—you can use ±2 as an empirical threshold for "needs attention."

reg y x1 x2 x3
predict rstud, rstudent   // studentized residuals
list if abs(rstud) > 2    // list unusual observations needing attention

Cook's Distance: Measures "how much all fitted values change after deleting the i-th observation," accounting for both the residual magnitude and the leverage value. Empirical threshold: Cook's D > 4/n warrants attention.

predict cook, cooksd
list if cook > 4/e(N)

DFBETA: Measures "by how many standard errors a specific coefficient β̂ⱼ changes after deleting the i-th observation." |DFBETA| > 2/√n warrants attention.

predict dfb_x1, dfbeta(x1)
list if abs(dfb_x1) > 2/sqrt(e(N))

Practical recommendations:

  • Do not automatically delete all observations flagged as "unusual." First investigate—are these observations data entry errors? Or are they genuine extreme cases in the sample? (For example, if you study firm performance, Apple and Amazon are genuine extreme values—they should not be deleted.)
  • If certain observations are data entry errors → correct or delete them, and document this in the paper.
  • If certain observations are genuine extreme values → report in a robustness check whether "the core conclusions change after removing these influential points." If they do not change → you can be more confident; if they do change → your conclusions are sensitive to these observations and require serious discussion.

4. Residuals for Special Analyses — Beyond Model Diagnostics

4.1 Using Residuals for "Partial Correlation" Analysis — The Residual Perspective of the FWL Theorem

Under the FWL theorem (see previous section), the coefficient on X₁ is equivalent to the following procedure:

  • Step 1: Regress X₁ on all other X's → take the residuals X~1\tilde{X}_1 (the unique part of X₁)
  • Step 2: Regress Y on all other X's → take the residuals Y~\tilde{Y} (the unique part of Y)
  • Step 3: Regress Y~\tilde{Y} on X~1\tilde{X}_1 in a simple regression

Residuals are "unique variation"—you use them to strip away the linear influence of confounding variables. Two steps of residual extraction + one step of simple regression = any single coefficient in a multiple regression. This perspective is indispensable for understanding advanced methods such as matching, fixed effects, and instrumental variables.

4.2 "Unusual Observation" Analysis in Regression Models — Residuals Help You Find the Story

When you find that certain observations have particularly large (or particularly small) residuals, ask yourself: Why is this observation's Y so far from what my model predicts?

Example: You study "a country's level of democracy (X) → economic growth (Y)." Your model predicts India should have a relatively high growth rate (because it is a democracy), but India's residual is negative—its actual growth is lower than the model predicts. Why?

The residual points you toward a "special case"—perhaps India's bureaucratic inefficiency, caste system, infrastructure, or other unique factors not controlled in your model are suppressing growth. Residuals are not just statistical garbage—they are signposts pointing toward "stories." In case study or mixed-methods research, observations with large residuals are often the most worthy subjects for in-depth investigation.

4.3 Testing Serial Correlation in Residuals — Time Series and Panel Data

In time series, today's residual may be correlated with yesterday's residual (Corr(et,et1)0\text{Corr}(e_t, e_{t-1}) \neq 0)—this violates the OLS no-autocorrelation assumption. In this case, OLS coefficients remain unbiased, but the standard error estimates may be biased (typically underestimated → inflated t-values → spurious significance).

Diagnostics:

Residual time series plot:

reg y x1 x2
predict e, residual
tsline e, yline(0)

If there are obvious "volatility clusters" (persistently positive for a period, persistently negative for a period) → a typical signal of positive autocorrelation.

Durbin-Watson test: estat dwatson. DW ≈ 2 → no first-order autocorrelation. DW → 0 → positive autocorrelation. DW → 4 → negative autocorrelation. This only tests first-order autocorrelation and requires that the model does not contain a lagged dependent variable.

Breusch-Godfrey test (more general): estat bgodfrey, lags(2). Can test higher-order autocorrelation and remains valid when the model includes lagged dependent variables.

In panel data: Within-group correlation in residuals is the core reason for using clustered standard errors—residuals for the same individual across different periods are often correlated, and ignoring this can lead to severely underestimated standard errors.

4.4 Using Residuals to Identify the Direction of Omitted Variable Bias — An Informal but Useful Technique

If you suspect an omitted variable Z (such as "ability"), and you cannot obtain data on Z, you can use theory and residuals to infer the direction of omitted variable bias.

Idea: Suppose you study the effect of education (X) on wages (Y). You suspect ability Z is omitted. It is known that ability Z is positively correlated with X, and ability Z is positively correlated with Y. Omitting Z means that part of ability's effect is attributed to education → the coefficient on education is biased upward (overestimated).

If you further observe that the sample correlation between the residuals (which contain omitted factors such as ability) and education (X) is positive, this qualitatively supports the judgment that "the omitted variable is positively correlated with X." This is not a formal test of omitted variable bias—but it helps you reasonably infer the direction of bias without data on Z, and discuss it in the paper.


5. Types of Residuals — Did You Know Stata Can Output Several Different Kinds?

Residual Type Stata Command Formula Purpose
Raw residuals predict e, residual ei=YiY^ie_i = Y_i - \hat{Y}_i The most basic residual, used for plotting rvfplot
Standardized residuals predict e_std, rstandard ei/σ^e_i / \hat{\sigma} Divides residuals by the residual standard deviation, approximating z-scores.
Studentized residuals predict e_stud, rstudent ei/(σ^(i)1hii)e_i / (\hat{\sigma}_{(i)}\sqrt{1-h_{ii}}) More accurate outlier diagnostics—estimates σ after deleting the observation itself and accounts for leverage
Jackknife residuals Same as above (equivalent to studentized residuals) Same as above Intermediate quantity for computing Cook's Distance
Deviance residuals predict dev, deviance Depends on the model Residual diagnostics in GLM
Pearson residuals predict pear, pearson (Yiμ^i)/V(μ^i)(Y_i - \hat{\mu}_i)/\sqrt{V(\hat{\mu}_i)} Fit diagnostics for nonlinear models such as logit/probit

Practical advice: For routine diagnostics, use standardized or studentized residuals. Raw residuals share the units of the original Y, but are not directly comparable across observations—a "large-looking" residual may simply reflect that Y's natural variation is large in that range. Studentized residuals standardize this difference, giving the threshold of 2 a comparable meaning across different data sets and models.


6. A Complete Residual Diagnostic Workflow

reg y x1 x2 x3

// 1. Homoskedasticity
rvfplot, yline(0)          // graphical diagnostic
estat hettest               // BP test

// 2. Normality
predict e, residual
kdensity e, normal          // kernel density plot
qnorm e                     // Q-Q plot
swilk e                     // Shapiro-Wilk test

// 3. Model specification
estat ovtest                // RESET test
acprplot x1, lowess         // augmented component-plus-residual plot

// 4. Outliers and influential points
predict rstud, rstudent     // studentized residuals
predict cook, cooksd        // Cook's Distance
predict lev, leverage       // leverage values
list if abs(rstud) > 2 | cook > 4/e(N)

// 5. If panel data / time series
estat dwatson               // Durbin-Watson
estat bgodfrey, lags(2)     // Breusch-Godfrey

// 6. If heteroskedasticity
reg y x1 x2 x3, robust      // robust standard errors

Do you need to report all these diagnostic results in the paper? No—but you need to have performed them. The usual practice is to mention it in one sentence in the main text—"Residual diagnostics for the model (residual-vs-fitted plots, Q-Q plots, and the RESET test) revealed no serious problems of heteroskedasticity, non-normality, or model misspecification"—and place the diagnostic figures in the online appendix or provide them upon request from reviewers. If diagnostics reveal a problem (e.g., heteroskedasticity), you should explain in the main text how you addressed it (e.g., using robust standard errors).


7. Summary

Five core uses of residuals:

  1. Testing homoskedasticity: Residual-vs-fitted plot (rvfplot) + BP test. Heteroskedasticity → robust standard errors.
  2. Testing normality: Q-Q plot + kernel density plot. Non-normality is not a serious problem in large samples; in small samples, be wary of extreme skewness or kurtosis.
  3. Testing model specification: Scatter plots of residuals vs. each independent variable + RESET test. Curvature → omitted nonlinear terms or interaction terms.
  4. Diagnosing outliers and influential points: Studentized residuals + Cook's Distance + DFBETA. Flag them, investigate them, and decide whether to delete them or conduct robustness analyses.
  5. Understanding and interpreting the underlying logic of methods: The FWL theorem, fixed effects, matching methods, and 2SLS can all be understood within the framework of "residual extraction." Residuals are not just a diagnostic tool—they are the key to understanding how econometric methods work.

One-sentence conclusion:

"If you only look at coefficients and p-values, you at most know how your model performs 'on average.' If you look at residuals, you learn where your model performs well at 'each specific point,' where it breaks down, and where a single data point is pulling your entire regression line with all its weight. The former gives you conclusions; the latter gives you confidence in those conclusions."


8. Presentation Suggestions for Bilibili/WeChat Official Account

  • Bilibili video: Use "physical examination" as the overarching metaphor. Opening: a person (the regression model) receives a physical examination report (the coefficient table), and all indicators "look normal"—R² is decent, coefficients are significant. Voiceover: "But this is just height and weight—have you looked at the electrocardiogram?" The screen cuts to four "ECGs" (four residual diagnostic plots): normal heartbeat → rvfplot with random scatter; arrhythmia → fan-shaped heteroskedasticity; cardiac arrest → a curved systematic deviation; a giant spike → an outlier causing "cardiac arrest." Voiceover: "Residuals are your model's physical examination report—they tell you where the model is healthy, where it is barely holding on, and where an anomalous data point is dragging your conclusions into the abyss." Then unfold in four acts: Act 1 "Blood test"—the distribution of residuals (normality); the Q-Q plot is the "blood test tube," deviation from the reference line = abnormal blood picture. Act 2 "Blood pressure measurement"—heteroskedasticity; the residual-vs-fitted plot is the "blood pressure monitor," a funnel shape = blood pressure soaring. Act 3 "CT scan"—model specification; the RESET test is the CT, curved residuals are the "tumor" (omitted nonlinearity). Act 4 "Mine clearance"—outliers; Cook's D is the "mine detector," highlighted points = "there is a data point hijacking your regression line." Closing image: the complete set of diagnostic reports is bound into a volume with the cover reading "Residual Diagnostics," voiceover: "Next time you run a regression—do the physical examination first, then draw conclusions."
  • WeChat Official Account: The residual-vs-error distinction table should be placed at the beginning. The four major diagnostics (homoskedasticity/normality/model specification/outliers) should each be made into a "diagnostic card"—symptom plot (typical anomalous patterns in residual plots) + cause (possible problem) + prescription (Stata command + treatment plan). The complete diagnostic workflow should be presented as a code block + flowchart. The comparison table of five residual types should be made into a quick-reference card. The residual perspective on partial correlation (FWL theorem) should be accompanied by a three-step residual extraction diagram. The distinction between "genuine extreme values vs. data entry errors" for outliers should be presented as a decision tree.
  • Recommended titles:
    • Main title: "What Are Residuals Used for in Empirical Research? — From Model Diagnostics to Special Problem Analysis"
    • Alternative title: "After Running Your Regression, Have You Looked at the Residuals? — Four Diagnostics to Avoid a 'Falsely Healthy' Model"
    • New media title: "Coefficients and R² Are Lying to You: Why 'Looking at Residuals' Is a Habit Every Empirical Researcher Must Develop"
  • Key quotes:

    "Residuals are the conversation between the model and the data—each residual tells you how well this point is explained by the model. Not looking at residuals is like declaring 'this is a perfect relationship' without reading the conversation record."

    "Coefficients tell you the 'average relationship between X and Y.' Residuals tell you—at which points this average relationship breaks down, in which regions it is distorted, and at which isolated observation the entire conclusion cannot stand."

    "A single data point can hijack your entire regression line. Cook's Distance and DFBETA are the alarms you sound before being hijacked."

    "Heteroskedasticity, non-normality, omitted nonlinearity—these problems are not written directly in any cell of the coefficient table. But they are all written in the residuals."