Regression Diagnostics
the exact \(t\) and \(F\) theory on estimation & inference is bought with assumptions: a linear mean, uncorrelated errors of constant variance, gaussian noise. diagnostics are how those assumptions are audited after the fit, and nearly all of them run through one matrix — the hat matrix \(\mathbf{H}\), whose diagonal measures how much each observation can pull the fit and whose complement \(\mathbf{I} - \mathbf{H}\) carries the residuals. 𐃏
the page builds the residual algebra first, then the influence measures it licenses (leverage, cook’s distance), then \(R^2\), then the catalogue of things that go wrong. the glm analogues (pearson and deviance residuals) live on generalised linear models and logistic regression.
the hat matrix and the residuals
for \(\mathbf{y} = \mathbf{X}\beta + \boldsymbol\varepsilon\) with \(\mathbf{X}\) of full rank \(p\), least squares gives \(\hat{\mathbf{y}} = \mathbf{X}\hat\beta\), and every fitted value is a fixed linear combination of the responses.
the residuals are \(e_i = y_i - \mathbf{x}_i^\top\hat\beta\). the hat matrix \(\mathbf{H} = \mathbf{X}(\mathbf{X}^\top\mathbf{X})^{-1}\mathbf{X}^\top\) puts the hat on \(\mathbf{y}\): \(\hat{\mathbf{y}} = \mathbf{H}\mathbf{y}\) and \(\mathbf{e} = (\mathbf{I} - \mathbf{H})\mathbf{y}\).
(1) \(\mathbf{H}\) and \(\mathbf{I} - \mathbf{H}\) are symmetric and idempotent; (2) \(\operatorname{tr}\mathbf{H} = \operatorname{rank}\mathbf{H} = p\) and \(\operatorname{tr}(\mathbf{I}-\mathbf{H}) = N - p\); (3) \(\mathbf{H}\mathbf{X} = \mathbf{X}\) and \((\mathbf{I}-\mathbf{H})\mathbf{X} = \mathbf{0}\).
symmetric plus idempotent is precisely an orthogonal projection: \(\hat{\mathbf{y}}\) is the point of the column space of \(\mathbf{X}\) nearest \(\mathbf{y}\), and \(\mathbf{X}^\top\mathbf{e} = \mathbf{0}\). two consequences are used constantly: with an intercept the residuals sum to zero, and \(\|\mathbf{y}\|^2 = \|\hat{\mathbf{y}}\|^2 + \|\mathbf{e}\|^2\) by pythagoras.
under the gauss–markov assumptions \(\operatorname{Var}(\mathbf{e}) = \sigma^2(\mathbf{I} - \mathbf{H})\), so \(\operatorname{Var}(e_i) = \sigma^2(1 - h_{ii})\) and \(\operatorname{Cov}(e_i, e_l) = -\sigma^2 h_{il}\). with gaussian errors, \(\mathbf{e} \sim N(\mathbf{0}, \sigma^2(\mathbf{I}-\mathbf{H}))\) and \(\mathbf{e}^\top\mathbf{e}/\sigma^2 \sim \chi^2_{N-p}\); hence \(\hat\sigma^2 = \mathrm{RSS}/(N-p)\) is unbiased.
the punchline for diagnostics: raw residuals are neither independent nor equally variable, even when the errors are. the covariance is singular (rank \(N-p\)) because \(p\) linear combinations of the residuals vanish identically. the square root \(\hat\sigma\) is what R prints as “residual standard error”. 𐃏
proofs
\begin{align} \mathbf{H}^\top &= \mathbf{X}[(\mathbf{X}^\top\mathbf{X})^{-1}]^\top\mathbf{X}^\top = \mathbf{H} && \text{inverse of a symmetric matrix is symmetric}\\ \mathbf{H}\mathbf{H} &= \mathbf{X}(\mathbf{X}^\top\mathbf{X})^{-1}\underbrace{\mathbf{X}^\top\mathbf{X}(\mathbf{X}^\top\mathbf{X})^{-1}}_{\mathbf{I}_p}\mathbf{X}^\top = \mathbf{H}\\ \operatorname{tr}\mathbf{H} &= \operatorname{tr}\big((\mathbf{X}^\top\mathbf{X})^{-1}\mathbf{X}^\top\mathbf{X}\big) = \operatorname{tr}\mathbf{I}_p = p && \operatorname{tr}(\mathbf{AB}) = \operatorname{tr}(\mathbf{BA}) \end{align}
an idempotent matrix has eigenvalues in \(\{0,1\}\) (\(\lambda v = Av = A^2v = \lambda^2 v\)) and is diagonalisable, so its rank equals its trace. \(\mathbf{H}\mathbf{X} = \mathbf{X}(\mathbf{X}^\top\mathbf{X})^{-1}\mathbf{X}^\top\mathbf{X} = \mathbf{X}\); the statements for \(\mathbf{I}-\mathbf{H}\) follow by expanding.
\begin{align} \mathbf{e} &= (\mathbf{I}-\mathbf{H})(\mathbf{X}\beta + \boldsymbol\varepsilon) = (\mathbf{I}-\mathbf{H})\boldsymbol\varepsilon && (\mathbf{I}-\mathbf{H})\mathbf{X} = \mathbf{0}\\ \operatorname{Var}(\mathbf{e}) &= (\mathbf{I}-\mathbf{H})\,\sigma^2\mathbf{I}\,(\mathbf{I}-\mathbf{H})^\top = \sigma^2(\mathbf{I}-\mathbf{H}) && \text{symmetric, idempotent}\\ \mathbf{e}^\top\mathbf{e} &= \boldsymbol\varepsilon^\top(\mathbf{I}-\mathbf{H})\boldsymbol\varepsilon = \mathbf{w}^\top\boldsymbol\Lambda\mathbf{w}, \quad \mathbf{w} = \mathbf{P}^\top\boldsymbol\varepsilon && \mathbf{I}-\mathbf{H} = \mathbf{P}\boldsymbol\Lambda\mathbf{P}^\top\\ &= \textstyle\sum_{k=1}^{N-p} w_k^2, \quad w_k \overset{iid}{\sim} N(0,\sigma^2) && N-p \text{ unit eigenvalues; rotation of iid normals} \end{align}
so \(\mathbf{e}^\top\mathbf{e}/\sigma^2 \sim \chi^2_{N-p}\), whose mean \(N-p\) gives unbiasedness of \(\hat\sigma^2\).
standardised and studentised residuals
since \(\operatorname{Var}(e_i) = \sigma^2(1-h_{ii})\), the fair way to judge the size of a residual is to divide by its own standard error.
\(e_i’ = \dfrac{e_i}{\hat\sigma\sqrt{1 - h_{ii}}}\). under the model each \(e_i’\) has mean zero and variance close to one: \(|e_i’| > 2\) happens in roughly 5% of cases, \(|e_i’| > 3\) rarely.
the name studentised is used two ways. the lecture uses it for exactly this plug-in quantity and flags \(|e_i’| > 3\) as a possible outlier; most texts reserve it for the version whose \(\hat\sigma_{(i)}\) is computed with observation \(i\) deleted, so that an outlier cannot inflate its own yardstick. in R, rstandard() is the first and rstudent() the second.
the policy matters as much as the formula: points are not deleted just because they fit badly. an outlier is a signal — a data error, or more often a feature of the problem the model has not represented — and the right response is frequently a different model in which the point is no longer extreme.
leverage and influence
leverage
the leverage of observation \(i\) is \(h_{ii}\), the \(i\)-th diagonal entry of \(\mathbf{H}\). it depends on \(\mathbf{X}\) alone, never on \(\mathbf{y}\).
\(0 \le h_{ii} \le 1\) and \(\sum_i h_{ii} = p\), so the average leverage is \(p/N\); values above two or three times \(p/N\) deserve a look. in simple linear regression \(h_{ii} = \frac1N + \frac{(x_i - \bar x)^2}{S_{xx}}\).
high leverage is dangerous precisely because it is quiet: \(\operatorname{Var}(e_i) = \sigma^2(1-h_{ii})\) shrinks as \(h_{ii} \to 1\), so the fit is dragged toward a high-leverage point and its residual looks small. at \(h_{ii} = 1\) the line passes through the point whatever its response. leverage says a point could move the fit; whether it does depends on its residual.
cook’s distance
\(D_i = \dfrac{\|\hat{\mathbf{y}} - \hat{\mathbf{y}}_{-i}\|^2}{p\,\hat\sigma^2}\), where \(\hat{\mathbf{y}}_{-i} = \mathbf{X}\hat\beta_{-i}\) are the fitted values at all \(N\) points from the fit with observation \(i\) removed: the influence of one datum on the whole fit.
\[ \hat\beta_{-i} = \hat\beta - \frac{e_i}{1 - h_{ii}}(\mathbf{X}^\top\mathbf{X})^{-1}\mathbf{x}_i, \qquad D_i = \frac{1}{p}\,\frac{h_{ii}}{1 - h_{ii}}\,e_i’^{\,2}. \]
so influence is leverage times standardised residual squared, and one fit suffices for all \(N\) deletions. the factor is the standardised residual, not the raw one (the lecture slide prints \(e_i^2\); with the raw residual the formula is off by \(\hat\sigma^2(1-h_{ii})\) and is not even dimensionless). 𐃏
cut-offs are rules of thumb: weisberg — a largest \(D_i\) well below 1 means no single deletion changes \(\hat{\mathbf{y}}\) much; fox — \(4/(N-2)\) flags noteworthy values in simple regression. better than any threshold: look for a gap in the sorted \(D_i\).
proofs
\(\sum_i h_{ii} = \operatorname{tr}\mathbf{H} = p\). since \(\mathbf{H} = \mathbf{H}^\top\mathbf{H}\), \(h_{ii} = \sum_l h_{li}^2 = h_{ii}^2 + \sum_{l\ne i} h_{li}^2 \ge h_{ii}^2\), so \(h_{ii}(1-h_{ii}) \ge 0\), i.e. \(0 \le h_{ii} \le 1\).
write \(\mathbf{A} = \mathbf{X}^\top\mathbf{X}\), \(h = h_{ii} = \mathbf{x}_i^\top\mathbf{A}^{-1}\mathbf{x}_i\). deleting row \(i\) gives \(\mathbf{A} - \mathbf{x}_i\mathbf{x}_i^\top\) and \(\mathbf{X}^\top\mathbf{y} - \mathbf{x}_i y_i\). sherman–morrison, checked by multiplying out:
\begin{align} (\mathbf{A} - \mathbf{x}_i\mathbf{x}_i^\top)^{-1} &= \mathbf{A}^{-1} + \frac{\mathbf{A}^{-1}\mathbf{x}_i\mathbf{x}_i^\top\mathbf{A}^{-1}}{1-h} && \text{product} = \mathbf{I} + \mathbf{x}_i\mathbf{x}_i^\top\mathbf{A}^{-1}\Big[\tfrac{1}{1-h} - 1 - \tfrac{h}{1-h}\Big] = \mathbf{I}\\ \hat\beta_{-i} &= \hat\beta - \mathbf{A}^{-1}\mathbf{x}_i y_i + \frac{\mathbf{A}^{-1}\mathbf{x}_i(\hat y_i - h y_i)}{1-h} && \mathbf{A}^{-1}\mathbf{X}^\top\mathbf{y} = \hat\beta,\ \mathbf{x}_i^\top\hat\beta = \hat y_i\\ &= \hat\beta - \mathbf{A}^{-1}\mathbf{x}_i\,\frac{e_i}{1-h} && \text{common denominator}\\ \|\hat{\mathbf{y}} - \hat{\mathbf{y}}_{-i}\|^2 &= \frac{e_i^2}{(1-h)^2}\,\mathbf{x}_i^\top\mathbf{A}^{-1}\mathbf{X}^\top\mathbf{X}\mathbf{A}^{-1}\mathbf{x}_i = \frac{e_i^2\,h}{(1-h)^2} \end{align}
dividing by \(p\hat\sigma^2\) and splitting \(\frac{e_i^2}{\hat\sigma^2(1-h)} = e_i’^2\) gives the result.
the coefficient of determination
the intercept-only model \(Y_i = \beta_0 + \varepsilon_i\) has \(\hat\beta_0 = \bar y\) and residual sum of squares \(\mathrm{TSS} = \sum_i(y_i - \bar y)^2\), the worst any model with an intercept can do.
\(R^2 = 1 - \mathrm{RSS}/\mathrm{TSS}\), the proportion of the total variation explained by the model. the adjusted version \(\bar R^2 = 1 - \dfrac{\mathrm{RSS}/(N-p)}{\mathrm{TSS}/(N-1)}\) compares variance estimates rather than sums of squares.
with an intercept, \(\mathrm{TSS} = \sum_i(\hat y_i - \bar y)^2 + \mathrm{RSS}\) and \(R^2 = \operatorname{Cor}(\mathbf{y}, \hat{\mathbf{y}})^2\); with one covariate this is the squared correlation of \(y\) and \(x\). the overall \(F\)-test of \(H_0: \beta_1 = \dots = \beta_{p-1} = 0\) is a function of \(R^2\) alone: \[ F = \frac{R^2}{1 - R^2}\cdot\frac{N-p}{p-1} \sim F_{p-1,\,N-p}. \]
\(R^2\) never decreases when a column is added — the saturated model scores 1 — so it cannot choose between models of different size; a small increase is evidence the new variable contributes little. the adjusted \(\bar R^2\), the nested \(F\)-test, aic and cross-validation are the tools for that job (model selection).
proofs
\(\mathbf{X}^\top\mathbf{e} = \mathbf{0}\) gives \(\sum_i e_i = 0\) (intercept column) and \(\sum_i \hat y_i e_i = 0\) (\(\hat{\mathbf{y}}\) is in the column space). writing \(y_i - \bar y = (\hat y_i - \bar y) + e_i\):
\begin{align} \textstyle\sum_i (y_i - \bar y)(\hat y_i - \bar y) &= \textstyle\sum_i(\hat y_i - \bar y)^2 && \text{cross terms vanish}\\ \mathrm{TSS} &= \textstyle\sum_i(\hat y_i - \bar y)^2 + \mathrm{RSS} && \text{same expansion, squared}\\ \operatorname{Cor}(\mathbf{y},\hat{\mathbf{y}})^2 &= \frac{[\sum_i(\hat y_i - \bar y)^2]^2}{\mathrm{TSS}\,\sum_i(\hat y_i - \bar y)^2} = \frac{\mathrm{TSS} - \mathrm{RSS}}{\mathrm{TSS}} = R^2 \end{align}
for \(F\): the overall test is \(F = \frac{(\mathrm{TSS} - \mathrm{RSS})/(p-1)}{\mathrm{RSS}/(N-p)}\); substitute \(\mathrm{TSS} - \mathrm{RSS} = R^2\,\mathrm{TSS}\) and \(\mathrm{RSS} = (1-R^2)\,\mathrm{TSS}\).
worked: cheddar cheese
\(N = 30\) mature cheddars from the la trobe valley, each scored for taste and analysed for (log) acetic acid, (log) hydrogen sulfide and lactic acid. the model \[ \text{taste} = \beta_0 + \beta_1\,\text{Acetic} + \beta_2\,\text{H2S} + \beta_3\,\text{Lactic} + \varepsilon \] has \(p = 4\).
cheese.lm <- lm(taste ~ Acetic + H2S + Lactic, data = cheddar) # faraway package
summary(cheese.lm)
Estimate Std. Error t value Pr(>|t|)
(Intercept) -28.8768 19.7354 -1.463 0.15540
Acetic 0.3277 4.4598 0.073 0.94198
H2S 3.9118 1.2484 3.133 0.00425 **
Lactic 19.6705 8.6291 2.280 0.03108 *
Residual standard error: 10.13 on 26 degrees of freedom
Multiple R-squared: 0.6518, Adjusted R-squared: 0.6116
F-statistic: 16.22 on 3 and 26 DF, p-value: 3.81e-06
- fit summary. \(\mathrm{RSS} = 2668.41\), \(\mathrm{TSS} = 7662.89\), so \(R^2 = 1 - 0.3482 = 0.6518\) and \(\hat\sigma^2 = 2668.41/26 = 102.63\) (\(\hat\sigma = 10.13\)). adjusted: \[ 1 - 102.63/(7662.89/29) = 1 - 102.63/264.24 = 0.6116\,. \]
- overall test from \(R^2\). \[ F = \frac{0.65177}{0.34823}\cdot\frac{26}{3} = 1.8717 \times 8.6667 = 16.22 \] on \((3, 26)\), \(p = 3.8 \times 10^{-6}\).
- one coefficient. holding acetic and lactic fixed, a unit of log-H2S adds 3.91 taste points; \(t = 3.133\), equivalently \(F = t^2 = 9.82\) on \((1,26)\); 95% interval \[ 3.9118 \pm 2.056 \times 1.2484 = (1.35, 6.48)\,. \] acetic adds nothing (\(p = 0.94\)) given the other two.
- diagnostics. average leverage \(p/N = 0.133\); the largest, \(h_{26,26} = 0.266\), sits right on the twice-average line. the largest standardised residual is \(e_{15}’ = 2.63\) and the largest cook’s distance \(D_{15} = 0.17\): above fox’s \(4/28 = 0.143\), far below weisberg’s 1, and the next values (0.12, 0.10) leave no gap. sample 15 earns a look, not a deletion.
what can go wrong
each gauss–markov assumption has a characteristic signature in a residual plot and a standard remedy.
| problem | where it shows | remedy |
|---|---|---|
| non-linear mean | U or arch in residuals vs fitted | transformed or polynomial covariates, splines |
| correlated errors | runs of same-sign residuals vs time | generalised least squares, time-series error models |
| heteroscedasticity | funnel in residuals vs fitted | concave transform of \(y\); weighted least squares |
| outliers | \(\lvert e_i’ \rvert > 3\) (or rstudent) | investigate; refine the model, do not just delete |
| high leverage | \(h_{ii} > 2p/N\) to \(3p/N\); large \(D_i\) | check the point; consider whether the model extends there |
| collinearity | huge standard errors; \(\mathrm{VIF} > 5\) or 10 | drop or combine the collinear predictors |
| non-normality | curved normal q-q plot | box–cox transformation of the response |
non-linearity
on the Auto data, mpg regressed on horsepower leaves a clear U in residuals against fitted values: positive at both ends, negative in the middle. adding \(\text{horsepower}^2\) flattens it. the quadratic is still a linear model — linear in \(\beta\) — so the cure is a new column, not a new estimator; polynomial, fractional-polynomial and interaction columns are developed on analysis of variance, and flexible ones on splines and smoothing. a funnel that survives the quadratic fit is a different problem.
correlated errors
if \(\operatorname{Var}(\boldsymbol\varepsilon)\) has off-diagonal entries, \[ \operatorname{Var}(\hat\beta) = (\mathbf{X}^\top\mathbf{X})^{-1}\mathbf{X}^\top\operatorname{Var}(\boldsymbol\varepsilon)\mathbf{X}(\mathbf{X}^\top\mathbf{X})^{-1} \] is not the printed \(\sigma^2(\mathbf{X}^\top\mathbf{X})^{-1}\). with positive correlation (the time-series case) the printed standard errors are too small, intervals too narrow, \(p\)-values too optimistic. the size of the damage is easy to compute in the simplest case:
for the intercept-only model with stationary AR(1) errors, \(\operatorname{Corr}(\varepsilon_t, \varepsilon_{t+k}) = \rho^k\), the true variance of \(\hat\beta_0 = \bar y\) exceeds the reported \(\tau^2/N\) by the factor \(\dfrac{1+\rho}{1-\rho}\) for large \(N\): 3 at \(\rho = 0.5\), 19 at \(\rho = 0.9\) (standard errors 1.7 and 4.4 times too small).
plot residuals in time order: at \(\rho = 0\) the signs flip almost every step; at \(\rho = 0.5\) runs appear; at \(\rho = 0.9\) the residuals form slow waves — and their spread shrinks, because the fitted line absorbs part of the drift, which is exactly how the residual variance comes to understate the error variance.
heteroscedasticity
non-constant \(\operatorname{Var}(\varepsilon_i)\) shows as a funnel widening with the fitted values. two remedies. a concave transform of the response (\(\log y\), \(\sqrt y\)) shrinks large responses more and damps a variance that grows with the mean. weighted least squares applies when variances are known up to a constant — if \(y_i\) averages \(n_i\) raw measurements, \(\sigma_i^2 = \sigma^2/n_i\) — and minimises \(\sum_i w_i(y_i - \mathbf{x}_i^\top\beta)^2\):
\[ \hat\beta_W = (\mathbf{X}^\top\mathbf{W}\mathbf{X})^{-1}\mathbf{X}^\top\mathbf{W}\mathbf{y}, \qquad \mathbf{W} = \operatorname{diag}(w_i),\ w_i \propto 1/\operatorname{Var}(Y_i), \]
which is the same \(\mathbf{X}^\top\mathbf{W}\mathbf{X}\) system fisher scoring solves at each step of irls: weighting by precision is what maximum likelihood does whenever variances differ (lm(..., weights = n)).
collinearity
when predictors are nearly linearly dependent, their separate effects are poorly identified and small perturbations of the data swing the estimates. the pairwise correlation matrix catches pairs; multicollinearity among three or more predictors can hide from it entirely.
\(\mathrm{VIF}(\hat\beta_j) = \dfrac{1}{1 - R^2_{X_j \mid X_{-j}}}\), with \(R^2_{X_j\mid X_{-j}}\) from regressing \(X_j\) on all other predictors. it is the ratio of \(\operatorname{Var}(\hat\beta_j)\) in the full model to its value if \(X_j\) were uncorrelated with the rest, so standard errors grow by \(\sqrt{\mathrm{VIF}}\). \(\mathrm{VIF} = 1\) is clean; above 5 (or 10) is a problem.
in ISLR’s Credit data, Limit and Rating have correlation 0.997, while Age correlates about 0.10 with each. regressing Balance on all three gives VIFs 160.59 (Limit), 160.67 (Rating), 1.01 (Age); check: \(1/(1 - 0.99688^2) = 160.5\). the consequence: alone with Age, Limit has coefficient 0.173 with standard error 0.0050 (\(t = 34.5\)); beside Rating it has 0.019 with standard error 0.063 (\(p = 0.76\)). the standard error grew by \(12.6 \approx \sqrt{160.6}\), and the strongest predictor in the data looks useless next to its twin. drop one — they carry the same information.
transforming the response
for \(y > 0\), \(y^{(\lambda)} = (y^\lambda - 1)/\lambda\) for \(\lambda \ne 0\) and \(\log y\) for \(\lambda = 0\). \(\lambda = 1\) is no change, \(\tfrac12\) the square root, \(-1\) the reciprocal, up to shift and scale. \(\lambda\) is chosen by profiling the gaussian likelihood of the transformed response (MASS::boxcox); the \(\lambda = 0\) case is the continuous limit, so the family has no seam.
proofs
\begin{align} \operatorname{Var}(\bar\varepsilon) &= \frac{1}{N^2}\sum_{s,t}\operatorname{Cov}(\varepsilon_s,\varepsilon_t) = \frac{\tau^2}{N^2}\Big[N + 2\sum_{k=1}^{N-1}(N-k)\rho^k\Big] && N-k \text{ pairs at lag } k\\ &\approx \frac{\tau^2}{N}\Big[1 + 2\sum_{k\ge1}\rho^k\Big] = \frac{\tau^2}{N}\cdot\frac{1+\rho}{1-\rho} && \textstyle\sum_{k\ge1}\rho^k = \rho/(1-\rho) \end{align}
\[ (\mathbf{y}-\mathbf{X}\beta)^\top\mathbf{W}(\mathbf{y}-\mathbf{X}\beta) = \mathbf{y}^\top\mathbf{W}\mathbf{y} - 2\beta^\top\mathbf{X}^\top\mathbf{W}\mathbf{y} + \beta^\top\mathbf{X}^\top\mathbf{W}\mathbf{X}\beta\,; \] the gradient \(-2\mathbf{X}^\top\mathbf{W}\mathbf{y} + 2\mathbf{X}^\top\mathbf{W}\mathbf{X}\beta\) vanishes at \(\hat\beta_W\).
with \(S_{jk} = \sum_i x_{ij}x_{ik}\) and \(r = S_{12}/\sqrt{S_{11}S_{22}}\):
\begin{align} \operatorname{Var}(\hat\beta_1) &= \sigma^2[(\mathbf{X}^\top\mathbf{X})^{-1}]_{11} = \frac{\sigma^2 S_{22}}{S_{11}S_{22} - S_{12}^2} = \frac{\sigma^2}{S_{11}(1 - r^2)} && 2\times2 \text{ inverse} \end{align}
against \(\sigma^2/S_{11}\) when \(x_1\) is alone, a ratio of \(1/(1-r^2)\), and \(r^2 = R^2_{X_1\mid X_2}\) with one other predictor. the block-inverse version gives the general formula. as \(r^2 \to 1\) the variance diverges; at \(r^2 = 1\), \(\mathbf{X}^\top\mathbf{X}\) is singular.
\(y^\lambda = e^{\lambda\log y} = 1 + \lambda\log y + \tfrac12\lambda^2(\log y)^2 + \cdots\), so \((y^\lambda - 1)/\lambda = \log y + \tfrac12\lambda(\log y)^2 + \cdots \to \log y\).
see also
- estimation & inference — the exact \(t\)/\(F\) results these checks protect
- analysis of variance — factor models, interactions and polynomial terms, the usual fixes for a wrong mean
- generalised linear models — pearson and deviance residuals, leverage from the final irls step
- logistic regression — why residual plots degenerate for binary responses
- model selection — where \(R^2\) stops being useful and penalised criteria take over
- cross-validation — the leave-one-out identity \(\hat\beta_{-i}\) above is what makes loocv free for least squares
- regularised regression — ridge as the other answer to collinearity
Comments