11 Model Criteria and Diagnostics

Model Criteria

When the number of features is small, say ≤40\leq 40, can brutal enumerate all the possible models. We need some criteria to compare them.

R2R^{2} and Adjusted Ra2R_{a}^{2}

Familiar. Note one thing: Ra2R^{2}_{a} can be negative when SSE≈SSTSSE \approx SST.

Mallows' CpC_{p}

In this section, ∣X\mid X, i.e. the given-design-matrix condition is not omitted for simplicity.

Proxy of E[∥Y^−μ∥2]σ2\dfrac{\mathbb{E}[\|\hat{Y}-\mu\|^{2}]}{\sigma^{2}}. Good model has value close to the number of variables pp.

Suppose

Y∣X∼N(μ,σ2I)Y\mid X \sim N(\mu,\sigma^{2}I)

where XX has PP columns with an all-one column. (So P−1P-1 variables are included.) and μ=Xβ\mu=X\beta.

Consider a model of p−1p-1 variables:

Y^p=Xp(XpTXp)−1XpTY=:HpY\hat{Y}^{p}=X_{p}(X_{p}^TX_{p})^{-1}X_{p}^TY=: H_{p}Y

We have

E[Y^p∣X]=HpE[Y∣X]V[Y^p∣X]=σ2Hp\mathbb{E}[\hat{Y}^{p}\mid X]=H_{p}\mathbb{E}[Y\mid X]\\ \mathbb{V}[\hat{Y}^{p}\mid X]=\sigma^{2}H_{p}

Consider the squared error

E[(Y^ip−μi)2∣X]=(E[Y^ip∣X]−μi)2+V[Y^ip∣X]\mathbb{E}[(\hat{Y}^{p}_{i}-\mu_{i})^{2}\mid X]=(\mathbb{E}[\hat{Y}^{p}_{i}\mid X]-\mu_{i})^{2}+\mathbb{V}[\hat{Y}^{p}_{i}\mid X]

Consider all the samples

∑i=1NE[(Y^ip−μi)2∣X]=∑i=1N(E[Y^ip∣X]−μi)2+∑i=1NV[Y^ip∣X]\sum_{i=1}^{N} \mathbb{E}[(\hat{Y}^{p}_{i}-\mu_{i})^{2}\mid X]=\sum_{i=1}^{N} (\mathbb{E}[\hat{Y}^{p}_{i}\mid X]-\mu_{i})^{2}+\sum_{i=1}^{N} \mathbb{V}[\hat{Y}^{p}_{i}\mid X]

The variance part

∑i=1NV[Y^ip∣X]=Tr(V[Y^p∣X])=pσ2\sum_{i=1}^{N} \mathbb{V}[\hat{Y}^{p}_{i}\mid X]=\mathrm{Tr}(\mathbb{V}[\hat{Y}^{p}\mid X])=p \sigma^{2}

The bias part

∑i=1N(E[Y^ip∣X]−μi)2=(⋅)T(⋅)=μT(I−Hp)μ=E[YT(I−Hp)Y∣X]−σ2Tr(I−Hp)=E[SSE(p)∣X]−(n−p)σ2\begin{align} \sum_{i=1}^{N} (\mathbb{E}[\hat{Y}^{p}_{i}\mid X]-\mu_{i})^{2} & = (\cdot)^T(\cdot) \\ & =\mu^T(I-H_{p})\mu \\ & = {\color{blue}\mathbb{E}[Y^T(I-H_{p})Y\mid X]-\sigma^{2} \mathrm{Tr}(I-H_{p})} \\ & = \mathbb{E}[SSE(p)\mid X]-(n-p)\sigma^{2} \end{align}

The blue line is because

X∼N(μ,Σ)  ⟹  E[XTAX]=μTAμ+Tr(AΣ)X\sim N(\mu,\Sigma)\implies \mathbb{E}[X^TAX]=\mu^TA\mu+ \mathrm{Tr}(A\Sigma)

Define

Γp=∑i=1NE[(Y^ip−μi)2∣X]σ2=E[SSE(p)∣X]σ2−(n−2p)\Gamma_{p}=\frac{\sum_{i=1}^{N} \mathbb{E}[(\hat{Y}^{p}_{i}-\mu_{i})^{2}\mid X]}{\sigma^{2}}=\frac{\mathbb{E}[SSE(p)\mid X]}{\sigma^{2}}-(n-2p)

  • The full model yields ΓP=P\Gamma_{P}=P.
  • Γp≥p\Gamma_{p}\geq p.

Mallows' CpC_{p} is defined as

Γ^p=SSE(p)σ^2−(n−2p)\hat{\Gamma}_{p}=\frac{SSE(p)}{\hat{\sigma}^{2}}-(n-2p)


Now the practical part. We never know how many variables can construct a true model, but we know the true model's CpC_{p} should be close to pp.

  • Among the models, choose the one that Cp≈pC_{p}\approx p. If more than one satisfy this, choose the one with smaller pp.
  • Cp≪pC_{p}\ll p indicates SSE(p)SSE(p) is very small. Overfitting.
  • Cp≫pC_{p}\gg p the model ignores important variables.

Why choose smaller pp ? CpC_{p} closer to pp is most important, I think.

Akaike Information Criterion (AIC)

Estimated likelihood L^\hat{L} with punishment on pp.

L(β,σ2)=∏i=1n12πσ2exp⁡(−(yi−xiTβ)22σ2)=(2πσ2)−n2exp⁡(−∥y−Xβ∥22σ2)\begin{aligned} L(\beta,\sigma^2) &=\prod_{i=1}^n \frac{1}{\sqrt{2\pi\sigma^2}} \exp\left(-\frac{(y_i-x_i^T\beta)^2}{2\sigma^2}\right)\\ &=(2\pi\sigma^2)^{-\frac n2} \exp\left(-\frac{\|y-X\beta\|^2}{2\sigma^2}\right) \end{aligned}

MLE estimator

β^=(XTX)−1XTYσ^2=SSEn\hat{\beta}=(X^TX)^{-1}X^TY\\ \hat{\sigma}^{2}=\frac{SSE}{n}

Estimated likelihood

L^=(2πσ^2)−n2exp⁡(−SSE2σ^2)=(2πeσ^2)−n2\hat L=(2\pi\hat\sigma^2)^{-\frac n2} \exp\left(-\frac{SSE}{2\hat\sigma^2}\right)=\left(2\pi e\hat{\sigma}^{2}\right)^{-\frac n2}

We believe good model should have less SSESSE, i.e. larger L^\hat{L}.


AIC(p)=−2log⁡(L^)+2pAIC(p)=-2\log(\hat{L})+2p

L^\hat{L} moves from 0 to 1, −2log⁡(L^)-2\log(\hat{L}) moves from ∞\infty to 00. But adding one variable has its punishment. AIC(p)AIC(p) smaller, the better.

Plug in L^=…\hat{L}=\dots, can get

AIC(p)=nlog⁡(SSE(p)n)+2p+terms have nothing to do with pAIC(p)= n\log \left( \frac{SSE(p)}{n} \right)+2p+\text{terms have nothing to do with }p

So AIC(p)=nlog⁡(SSE(p)n)+2pAIC(p)= n\log \left( \frac{SSE(p)}{n} \right)+2p is another definition.

AIC is equivalent to Mallows' CpC_{p} for Gaussian linear regression (Boisbunon et al., 2014)

Bayesian Information Criterion (BIC)

BIC(p)=−2log⁡(L^)+plog⁡nBIC(p)=-2\log(\hat{L})+p\log n

Another definition:

BIC(p)=nlog⁡(SSE(p)n)+plog⁡nBIC(p)= n\log \left( \frac{SSE(p)}{n} \right)+p\log n

More punishment on adding variables. So tends to select models with less variables.

PRESS

Indicates the model's prediction ability.

Prediction Residual Error Sum of Squares.

PRESS(p)=∑i=1N(Yi−Y^i(−i))2PRESS(p)=\sum_{i=1}^{N} (Y_{i}-\hat{Y}_{i(-i)})^{2}

where Y^i(−i)\hat{Y}_{i(-i)} is the predicted value of YiY_{i} by model estimated with X,YX,Y excluding the i−i-th row.

It's a form of cross-validation (leave one out). Smaller, better.

In fact we have

Yi−Y^i(−i)=ei1−hiiY_{i}-\hat{Y}_{i(-i)}=\frac{e_{i}}{1-h_{ii}}

TO BE DONE

Prediction Rp2R^{2}_{p}

Rp2=1−PRESSSSTR_{p}^{2}=1-\frac{PRESS}{SST}

  • Can be negative
  • Rp2≪R2R_{p}^{2}\ll R^{2} indicates overfitting. The model is very unstable, high variance.

Diagnostics

Partial Regression Plots

One plot for each XiX_i

  • Use the other XX's to predict YY, get residuals Y∣X−iY \mid X_{-i}.
  • Use the other XX's to predict XiX_i, get residuals Xi∣X−iX_i \mid X_{-i}.
  • Plot residuals Y∣X−iY \mid X_{-i} vs. residuals Xi∣X−iX_i \mid X_{-i}.

Visualization of FWL theorem.

Detecting Outliers

Refer to Lec6-Diagnostics-Remedies-and-Miscellaneous-Topics › Residuals vs Leverage to recall

  • Extreme values
    • outliers
    • high leverage points

Studentized Residuals

e∼N(0,σ2(I−H))e\sim N(0,\sigma^{2}(I-H))

So eie_{i}'s don't have equal variances. Do something to make them comparable, i.e., let them (approximately) have the same distribution.

Define

ei∗=eiMSE⋅(1−hii)e^{*}_{i}=\frac{e_{i}}{\sqrt{MSE\cdot(1-h_{ii})}}

to test outliers.

Studentized Deleted Residuals

Let

di=Yi−Y^i(−i)=ei1−hiid_{i}=Y_{i}-\hat{Y}_{i(-i)}=\frac{e_{i}}{1-h_{ii}}

then

V[di]=σ21−hii\mathbb{V}[d_{i}]=\frac{\sigma^{2}}{1-h_{ii}}

Studentized deleted residuals is defined as

ti=dis(di)=eiMSE(−i)⋅(1−hii)∼tn−p−1t_{i}=\frac{d_{i}}{s(d_{i})}=\frac{e_{i}}{\sqrt{MSE_{(-i)}\cdot(1-h_{ii})}}\sim t_{n-p-1}

Declare case ii is an outlier if

∣ti∣>t1−α/2n,n−p−1(recall Bonferroni Adjustment)|t_{i}|>t_{1-\alpha/2n,n-p-1}\quad \text{(recall Bonferroni Adjustment)}

Can show that

(n−p)MSE=(n−p−1)MSE(−i)+ei21−hii(n-p)MSE=(n-p-1)MSE_{(-i)}+\frac{e_{i}^{2}}{1-h_{ii}}

Detecting High Leverage

575

Detecting Influential Points

DIFFITS

See slides.

Cook's Distance

Standardized Mahalanobis distance.

We know

β^∼N(β,σ2(XTX)−1)\hat{\beta}\sim N(\beta, \sigma^{2}(X^TX)^{-1})

Recall Mahalanobis distance dM(⋅,⋅)d_{M}(\cdot,\cdot)

dM2(β^,β)=(β^−β)TCov(β^)−1(β^−β)=(β^−β)TXTX(β^−β)σ2d_{M}^{2}(\hat{\beta},\beta)=(\hat{\beta}-\beta)^T\mathrm{Cov}(\hat{\beta})^{-1}(\hat{\beta}-\beta)= \frac{(\hat{\beta}-\beta)^TX^TX(\hat{\beta}-\beta)}{\sigma^{2}}

can show that dM2(β^,β)∼χp2d^{2}_{M}(\hat{\beta},\beta)\sim \chi^{2}_{p}. So E[dM2(β^,β)]=p\mathbb{E}[d_{M}^{2}(\hat{\beta},\beta)]=p.

Define Cook's distance for i−i-th case as

Di=(β^−β^(−i))TXTX(β^−β^(−i))p⋅MSE=∥X(β^−β^(−i))∥2p⋅MSED_{i}=\frac{(\hat{\beta}-\hat{\beta}_{(-i)})^TX^TX(\hat{\beta}-\hat{\beta}_{(-i)})}{p\cdot MSE}=\frac{\|X(\hat{\beta}-\hat{\beta}_{(-i)})\|^{2}}{p\cdot MSE}

Can show that

Di=∑i=1N(Y^j−Y^j(−i))2p⋅MSE=(ei1−hii)2⋅hiip⋅MSED_{i}= \frac{\sum_{i=1}^{N} (\hat{Y}_{j}-\hat{Y}_{j(-i)})^{2}}{p\cdot MSE}= \left( \frac{e_{i}}{1-h_{ii}} \right)^{2}\cdot \frac{h_{ii}}{p\cdot MSE}

DFBETAS

See slides.

Detecting Multicollinearity

VIF (Variance Inflation Factor) is defined as

VIFk=(1−Rk2)−1VIF_{k}=(1-R^{2}_{k})^{-1}

where Rk2R_{k}^{2} is obtained from Xk∼X−kX_{k}\sim X_{-k}.

584


11 Model Criteria and Diagnostics
https://wtx17.github.io/2026/12/01/Lec11-Model-Criteria-and-Diagnostics/
作者
wtx
发布于
2026年12月1日
更新于
2026年12月2日
许可协议