Unit 5 / 11

Regression Diagnostics and Violations: Collinearity, Heteroscedasticity, Autocorrelation

Gains:

  • Ability to detect violations such as multicollinearity, heteroscedasticity and autocorrelation with diagnostic tests and graphics with artificial intelligence support
  • Ability to distinguish whether each violation distorts coefficient estimates or standard errors and choose the appropriate correction (robust standard error, transformation, model revision)
  • Ability to verify that the fixes suggested by the AI solve the problem rather than hiding it and that the diagnosis is based on an understanding of the process that produces the data

Reading the output of a regression is easy; It's hard to trust him. Because the coefficients are unbiased, the standard errors are correct, and the p-values ​​are valid, depending on the assumptions we introduced in the previous unit are met. In this unit, we will cover the three most common violations: multicollinearity, heteroscedasticity, and autocorrelation. We'll answer three questions for each: how to diagnose it, what it breaks (coefficient or standard error), and how to fix it. Artificial intelligence (AI) generates the code for diagnostic testing and correction; but you decide which violation is really the problem and whether the fix solves the problem.

Let's make the most critical distinction up front: Does a violation distort the coefficient estimate or just the standard errors? This distinction determines the solution. A problem that distorts the coefficient (e.g. exogeneity violation) requires rethinking the model; A problem that only distorts the standard error (heteroscedasticity, autocorrelation) is often solved by standard error correction. A common mistake of AI is to apply a technique that corrects the standard error and then declare the problem “solved”; whereas the underlying structure may still be there.

Violation 1: Multicollinearity

Why? Two or more explanatory variables are strongly related to each other; for example, putting both “total years of experience” and “age” into the model. Since these variables carry almost the same information, the model has difficulty separating them.

What does it break? Coefficient estimates remain unbiased but become unstable: standard errors become inflated, confidence intervals widen, individual coefficients may turn out to be insignificant while the model may be significant overall (F-test). A small data change moves the coefficient significantly.

How is it diagnosed? VIF (Variance Inflation Factor): for each variable, it measures how much that variable is explained by the others. As a rough threshold, VIF > 5 (some 10) warrants caution. Additionally, the correlation matrix between explanatory variables is examined.

How to fix? Dropping one of the correlated variables, combining them (making an index), or (if the theory requires) keeping both and avoiding interpreting individual coefficients. Which variable stays is a theoretical decision, not a statistical one — AI suggests elimination, you provide the justification.

Violation 2: Heteroscedasticity

Why? The variance of the error term is not constant across observations. Typical example: as income increases, so does the dispersion around spending; A "funnel" pattern is formed, narrow at low income and wide at high income.

What does it break? Coefficient estimates are again unbiased — this is important. What gets distorted are the standard errors: they are calculated incorrectly, so p-values ​​and confidence intervals become unreliable. So your coefficient is in the right center, but the answer to the question "how confident are you" is wrong.

How is it diagnosed? Scatter plot of residuals versus predicted values ​​(funnel pattern sought) and formal tests: Breusch-Pagan test, White test. Small p-value says "no constant variance".

How to fix? The most common and practical solution is to use robust standard errors (robust / heteroskedasticity-consistent, HC standard errors): it does not change the coefficient, it corrects the standard error for violation. Alternative: transforming the dependent variable (like log) or weighted LCM. Robust standard errors have become almost the default in empirical work today.

Violation 3: Autocorrelation

Why? The error terms are not independent of each other; It is most common in time series: the error of one period affects the next (e.g. the residual remains positive in periods following a shock).

What does it break? Again, it primarily distorts standard errors (often understates them, creating false significance); The coefficients remain unbiased in the LCC but lose their effectiveness.

How is it diagnosed? Durbin-Watson test (for first-order autocorrelation), Breusch-Godfrey test (more general), and plots of residuals versus lagged values.

How to fix? Newey-West (HAC — resistant to autocorrelation and heteroskedasticity) standard errors, adding lagged terms to the model, or switching to the appropriate time series model (unit 8).

Caution: Heteroscedasticity and autocorrelation distort the standard error, not the coefficient. Therefore, before saying "the coefficient was significant", make sure that the standard error is calculated correctly; Otherwise meaningfulness may be an illusion.

comparison chart

violation

What breaks

Diagnosis

Common solution

multi-link

Inflates standard errors, makes the coefficient unstable

VIF, correlation matrix

Subtract/combine variable (by theory)

heteroscedasticity

Standard errors (coefficient unbiased)

Breusch-Pagan, White, residual plot

Robust (HC) standard error, conversion

Autocorrelation

Standard errors (coefficient unbiased)

Durbin-Watson, Breusch-Godfrey

Newey-West (HAC), delayed term

Four copyable prompts

1. Complete diagnostic package:

Your role: regression diagnostic assistant. I want R code, I do not share the data. Model: lm(expenditure ~ income + age + region, data = data). Task: (1) Calculate VIF, (2) Test heteroskedasticity with Breusch-Pagan and residual-estimate plot, (3) Test autocorrelation with Durbin-Watson. Explain in the comment line what violation each test measures and how to interpret the p-value. Correction APPLICATION; produce diagnosis.

2. Robust standard error:

Write R code that reproduces the coefficient table with heteroskedasticity-robust (HC3) standard errors for the same model (sandwich + lmtest packages). Produce a table showing the classical and robust standard errors side by side so I can see the difference. Emphasize in the comment line that the coefficients DO NOT change, only the standard errors do.

3. Multi-link review:

Give me a THINK list of variables with high VIF: which variables could theoretically measure the same thing, which ones have a strong case for keeping them. DO NOT auto-qualify; I will make the decision based on theory. Also explain why it might be wrong to just look at VIF and assign variables.

4. Autocorrelation correction:

In my time series regression, the Breusch-Godfrey p-value was 0.001. Write R code that produces the coefficient table with Newey-West (HAC) standard errors and explain how to select the lag. Note that this correction does not solve the CAUSE of autocorrelation, it just corrects the inference.

Weak prompt / Strong prompt

Weak prompt:

Is there a problem with my regression? If so, fix it.

This prompt puts the AI ​​in a blind “fix” mode: it can skip tests and apply a direct transformation or variable elimination, without showing you which violation actually exists and what it broke.

Powerful prompt:

Your role: diagnostic assistant, not autocorrector. First test for THREE violations separately (multicollinearity, heteroscedasticity, autocorrelation) and for each: which test, how to read the result, does it break COEFFICIENT or STANDARD ERROR. Then only suggest a fix for the violation that ACTUALLY was detected and explain how I can verify that the fix fixed the problem.

Difference: strong will forces diagnosis before correction and demands clear distinction between "what it breaks".

three mini cases

Case 1 — Spurious significance (heteroscedasticity). One analyst found the revenue coefficient in the spending ~ revenue model to be “significant” at p=0.01. But now there was a distinct funnel pattern on his chart. When robust standard errors were applied, the p-value increased to 0.09; meaningfulness is lost. The first result was an illusion created by a miscalculated standard error. Lesson: significance cannot be trusted without correcting the standard error.

Case 2 — Blind variable elimination. One student dropped the "experience" variable from the model because his VIF was high; The coefficients were “cleaned up” but the theoretical meaning of the model was distorted because experience was the main variable of interest. The correct way: subtract age and keep experience, or combine the two. Lesson: The VIF threshold alone is not grounds for elimination; theory determines.

Case 3 — Uncertainty hidden by autocorrelation. In a time series study, Durbin-Watson was ignored; the coefficient seemed very "precise" (narrow confidence interval). When Newey-West standard errors were applied, the confidence interval doubled and the policy recommendation became much more conservative. Lesson: autocorrelation can underestimate uncertainty.

Common mistakes

  • Mistaking the violation that distorts the standard error as a coefficient problem. Heteroscedasticity and autocorrelation do not distort the coefficient; Don't panic and rebuild the model unnecessarily, correct the standard error first.
  • Looking at VIF and blindly assigning variables. Removing a theoretically necessary variable just because the VIF is high makes the model meaningless.
  • Not verifying the fix. After applying robust standard error, check that the violation actually corrects the inference; Don't say "I applied it, it's done".
  • Fix without diagnosis. Applying transformation/elimination without testing which violation exists can "solve" the problem where it doesn't exist and hide the one that does.
  • Putting the fix in place why. Newey-West does not resolve the cause of autocorrelation; it just fixes the inference. If there is a structural problem, the model must be changed.
Tip: For each violation, ask yourself "is this destroying the coefficient or my confidence in it?" If the answer is “confidence,” the solution is almost always standard error correction, not rebuilding the model.

In summary

Regression diagnostics is a prerequisite for trusting the output. Of the three common violations, multicollinearity makes the coefficient unstable and inflates the standard error; Heteroskedasticity and autocorrelation, on the other hand, leave the coefficient unbiased and only distort the standard error. The AI ​​generates the diagnostic and fix code, but you decide which violation is the real problem, which variant remains theoretical, and whether the fix solves the problem. Neither panic nor blind correction is correct without clarifying the distinction between "what is breaking".

Application task

Set up a multivariate regression and ask the AI ​​for a code that only produces diagnoses (no corrections): VIF, Breusch-Pagan/White, and Durbin-Watson/Breusch-Godfrey. For each test, interpret the result and indicate whether the violation distorts the coefficient or the standard error. For a real violation you detect (e.g. heteroscedasticity), apply robust standard errors and juxtapose classical and robust results; Show that the coefficient does not change but the standard error changes. In one paragraph, report how your significance result was affected by the correction.

checklist

  • [ ] I tested three violations (multicollinearity, heteroskedasticity, autocorrelation) separately.
  • [ ] For each violation, I differentiated whether it distorts the coefficient or the standard error.
  • [ ] I based variable elimination in multicollinearity on theory, not just VIF.
  • [ ] I used standard error with robustness to heteroscedasticity/autocorrelation (HC/HAC).
  • [ ] After correction, I checked and verified the impact of the violation on my inference.
  • [ ] I report how my significance result was affected by standard error correction.