Contents
06Interview follow-ups
6.1Why squared residuals?
Three reasons. First, with normal errors, least squares is maximum likelihood (Episode 5). The log-likelihood of the model (1) with \varepsilon_i\sim\mathcal N(0,\sigma^2) is
so maximizing the likelihood over \beta is the same as minimizing RSS (Murphy, 2022, eq. 11.4–11.5). Second, squares give the closed form (5). Third, by Gauss–Markov, least squares is BLUE even without normality. The price is sensitivity to outliers: a residual twice as large counts four times as much; the absolute or Huber loss (Episode 7) is more robust.
6.2Is multicollinearity a violation?
Perfect collinearity is: if the columns of X are not linearly independent (one input variable is an exact linear combination of the others), X does not have full column rank, X^\top X cannot be inverted, and (5) has infinitely many solutions. The classic example is the dummy-variable trap, one indicator for every category plus an intercept. Strong but imperfect collinearity breaks none of Assumptions 1–5: the estimates stay unbiased and least squares stays BLUE. But it inflates their variance. For input j,
where S_{jj}=\sum_i(x_{ij}-\bar x_j)^2 and R_j^2 is the R^2 of regressing x_j on all the other inputs. The first factor is the one-input variance (11); the second, the variance inflation factor, says how much the other inputs inflate it. When x_j is almost a combination of the others, R_j^2 is close to 1 and the variance explodes: the data cannot tell the two inputs apart, so any split of their joint effect fits about equally well. A common rule of thumb flags a VIF above 5 or 10 (James et al., 2021, §3.3.3).
Worked example 6 (Cholesterol, twice). Total cholesterol and LDL cholesterol correlate at 0.90 (Figure 7a). In the model with all ten inputs their variance inflation factors are 59 and 39, and their coefficients take opposite signs, -1.09 and +0.75, with large standard errors. Drop LDL, and the coefficient of total cholesterol becomes -0.31 with a standard error of 0.16, while the fit barely changes (R^2 from 0.518 to 0.516).
Multicollinearity is a problem for interpretation, not for prediction. For stable coefficients, drop or combine the redundant inputs, or use ridge regression, which adds \lambda I to X^\top X and stabilizes the inverse (Episode 4).
6.3How do you check the assumptions?
Mostly with pictures of the residuals, which is why Anscombe (1973) insisted on plotting the data: his four famous data sets have the same means, variances, correlation and fitted line, and completely different pictures. Table 1 collects the classic checks. Only Assumption 2 has no residual check, because least squares makes the residuals uncorrelated with every included input by construction.
| assumption | if it fails | how to check | what to do |
|---|---|---|---|
| 1 linearity | biased fit | curve in residuals vs fitted | add x^2, transform |
| 2 zero-mean errors | biased slopes | knowledge of the problem | add the variable |
| 3 constant variance | wrong standard errors | funnel in residuals vs fitted | robust errors, weights |
| 4 independent errors | errors too small | residuals over time | clustered errors |
| 5 normal errors | small-n tests not exact | Q–Q plot of residuals | large n, bootstrap |
| full rank | inflated variance | variance inflation factors | drop, combine, ridge |