UniMaths
Free chapterTry everything here: cards, proofs and practice. Sign up free to save your progress and unlock all 4 chapters.Sign up free
LINMOD · 1

The general linear model

10 concepts · 17 questions

The hat matrix as a projection, Cochran's theorem, the distribution of the estimators, F tests for nested models, one-way ANOVA, confidence and prediction intervals, collinearity, and model selection criteria.

Overview 1The plan of this section

Least squares is orthogonal projection. Seeing it that way gives every distribution and test in regression at once.

  1. The hat matrix (Prop. 1.1) and Cochran's theorem (Lemma 1.2), giving the sampling distribution of β^\hat\beta and s2s^2 (Thm 1.3).
  2. The F test for nested models (Thm 1.4), with one-way ANOVA (Example 1.5).
  3. Confidence and prediction intervals (Prop. 1.6), collinearity (Example 1.7) and model selection (Def. 1.8).

Y^=HY\hat Y = HY is a projection; projections of normal vectors give χ2\chi^2, tt and FF statistics.

Proposition 1.1The hat matrix

H=X(XTX)−1XTH = X(X^{\mathsf T}X)^{-1}X^{\mathsf T} is the orthogonal projection onto the column space C(X)\mathcal C(X): HT=HH^{\mathsf T} = H, H2=HH^2 = H, rank⁡H=tr⁡H=p\operatorname{rank}H = \operatorname{tr}H = p. The fitted values are Y^=HY\hat Y = HY, the residuals e=(I−H)Ye = (I - H)Y, and Y^⊥e\hat Y\perp e.

HH projects onto the columns of XX; tr⁡H=p\operatorname{tr}H = p; residuals live in the (n−p)(n - p)-dimensional complement.

Proof

Lemma 1.2Cochran's theorem (projection form)

Let Z∼N(μ,σ2In)Z\sim N(\mu, \sigma^2I_n) and let P1,…,PkP_1, \dots, P_k be orthogonal projections onto mutually orthogonal subspaces of dimensions r1,…,rkr_1, \dots, r_k. Then P1Z,…,PkZP_1Z, \dots, P_kZ are independent, and if Pjμ=0P_j\mu = 0 then ∥PjZ∥2/σ2∼χrj2\|P_jZ\|^2/\sigma^2\sim\chi^2_{r_j}.

Orthogonal pieces of a normal vector are independent; squared lengths of mean-zero pieces are σ2χ2\sigma^2\chi^2.

Proof

Theorem 1.3Sampling distribution in the normal linear model

In the normal linear model, β^∼Np(β,σ2(XTX)−1)\hat\beta\sim N_p(\beta, \sigma^2(X^{\mathsf T}X)^{-1}), RSS/σ2∼χn−p2\mathrm{RSS}/\sigma^2\sim\chi^2_{n-p}, and β^\hat\beta and RSS\mathrm{RSS} are independent. Hence s2=RSSn−ps^2 = \frac{\mathrm{RSS}}{n - p} is unbiased for σ2\sigma^2 and

β^j−βjs[(XTX)−1]jj∼tn−p.\frac{\hat\beta_j - \beta_j}{s\sqrt{[(X^{\mathsf T}X)^{-1}]_{jj}}}\sim t_{n-p}.

β^∼N(β,σ2(XTX)−1)\hat\beta\sim N(\beta, \sigma^2(X^{\mathsf T}X)^{-1}), RSS∼σ2χn−p2\mathrm{RSS}\sim\sigma^2\chi^2_{n-p}, independent; coefficient tt tests with n−pn - p degrees of freedom.

Proof

Theorem 1.4The F test for nested models

Let C(X0)⊆C(X)\mathcal C(X_0)\subseteq\mathcal C(X) with dimensions p0<pp_0 < p, and test H0H_0: EY∈C(X0)\mathbb EY\in\mathcal C(X_0). With RSS0\mathrm{RSS}_0, RSS\mathrm{RSS} the residual sums of squares and q=p−p0q = p - p_0,

F=(RSS0−RSS)/qRSS/(n−p)∼Fq,n−punder H0.F = \frac{(\mathrm{RSS}_0 - \mathrm{RSS})/q}{\mathrm{RSS}/(n - p)}\sim F_{q, n-p}\quad\text{under }H_0.

Reject H0H_0 for large FF. For q=1q = 1, F=t2F = t^2 for the corresponding coefficient.

F=ΔRSS/qRSS/(n−p)F = \frac{\Delta\mathrm{RSS}/q}{\mathrm{RSS}/(n - p)}: does adding qq parameters reduce the residual sum of squares more than noise would?

Proof

Example 1.5One-way ANOVA as a linear model

With kk groups, Yij=μi+εijY_{ij} = \mu_i + \varepsilon_{ij} (j=1,…,nij = 1, \dots, n_i, n=∑nin = \sum n_i) is a linear model with p=kp = k indicator columns; μ^i=Yˉi⋅\hat\mu_i = \bar Y_{i\cdot}. Testing H0H_0: μ1=⋯=μk\mu_1 = \cdots = \mu_k (the intercept-only model) gives

F=∑ini(Yˉi⋅−Yˉ)2/(k−1)∑i,j(Yij−Yˉi⋅)2/(n−k)∼Fk−1,n−k,F = \frac{\sum_in_i(\bar Y_{i\cdot} - \bar Y)^2/(k - 1)}{\sum_{i,j}(Y_{ij} - \bar Y_{i\cdot})^2/(n - k)}\sim F_{k-1, n-k},

the ratio of between-group to within-group mean squares.

ANOVA = F test of "all group means equal": between-group variation over within-group variation.

Proposition 1.6Confidence and prediction intervals

At a new covariate vector x0x_0, with v0=x0T(XTX)−1x0v_0 = x_0^{\mathsf T}(X^{\mathsf T}X)^{-1}x_0:

  • a 100(1−α)%100(1 - \alpha)\% confidence interval for the mean x0Tβx_0^{\mathsf T}\beta is x0Tβ^±tn−p,α/2 sv0x_0^{\mathsf T}\hat\beta\pm t_{n-p, \alpha/2}\,s\sqrt{v_0};
  • a prediction interval for a new response Y0=x0Tβ+ε0Y_0 = x_0^{\mathsf T}\beta + \varepsilon_0 is x0Tβ^±tn−p,α/2 s1+v0x_0^{\mathsf T}\hat\beta\pm t_{n-p, \alpha/2}\,s\sqrt{1 + v_0}.

CI for the mean: sv0s\sqrt{v_0}; prediction interval: s1+v0s\sqrt{1 + v_0} (always wider: includes new noise).

Proof

Example 1.7Collinearity and variance inflation

Var⁡β^j=σ2(1−Rj2)∑i(xij−xˉj)2\operatorname{Var}\hat\beta_j = \frac{\sigma^2}{(1 - R_j^2)\sum_i(x_{ij} - \bar x_j)^2}, where Rj2R_j^2 is the R2R^2 from regressing column jj on the other columns. The factor VIFj=11−Rj2\mathrm{VIF}_j = \frac1{1 - R_j^2} is the variance inflation factor. Nearly collinear predictors (Rj2≈1R_j^2\approx1) make individual coefficients unstable and insignificant even when the overall fit is good; values above about 1010 are a warning.

VIFj=1/(1−Rj2)\mathrm{VIF}_j = 1/(1 - R_j^2): correlated predictors inflate coefficient variances.

Definition 1.8Model selection criteria

Adding predictors never increases RSS\mathrm{RSS}, so fit alone favours the largest model. Criteria that penalise size:

  • adjusted Radj2=1−RSS/(n−p)TSS/(n−1)R^2_{\mathrm{adj}} = 1 - \frac{\mathrm{RSS}/(n - p)}{\mathrm{TSS}/(n - 1)};
  • AIC =nlog⁡(RSS/n)+2p= n\log(\mathrm{RSS}/n) + 2p and BIC =nlog⁡(RSS/n)+plog⁡n= n\log(\mathrm{RSS}/n) + p\log n (smaller is better);
  • Mallows' CpC_p =RSSpσ^2−n+2p= \frac{\mathrm{RSS}_p}{\hat\sigma^2} - n + 2p, with σ^2\hat\sigma^2 from the full model. Search strategies: all subsets, forward or backward stepwise.

Penalise complexity: adjusted R2R^2, AIC (+2p+2p), BIC (+plog⁡n+p\log n), CpC_p.

Check 1.9Check: inference in a linear model

  • Count parameters pp (including the intercept) and residual degrees of freedom n−pn - p.
  • One coefficient: tt test. Several at once: F test comparing nested fits.
  • Mean response: confidence interval; new observation: prediction interval.
  • Insignificant coefficients with a good overall fit: check collinearity (VIFs).

Degrees of freedom n−pn - p; tt for one, FF for several; CI vs PI; watch collinearity.