Linear models
We try to find a linear relationship between $X\in \R^{n\times p}$ the design matrix (independent variables) and $Y\in \R^{n}$ the response (dependent variables). Each row is a single observation.
The (homoscedastic) normal linear model assumes $$ \begin{align*} Y\mid X \sim N(X β, σ^2 I_n) \end{align*} $$ where $β\in \R^p$ and $σ^2>0$ are unknown parameters.
This can alternatively be expressed as $$ \begin{align*} Y = X β + ε \end{align*} $$ where $ε\sim N(0_n, σ^2 I_n)$.
The (homoscedastic) linear conditional expectation model assumes $$ \begin{align*} \expect(Y\mid X) = X β, \qquad \var(Y\mid X) = σ^2 I_n \end{align*} $$ where $β\in \R^p$ and $σ^2>0$ are unknown parameters.
The least square estimator for $β$ is $$ \begin{align*} \hat β = \arg\min_{β\in \R^p} \|Y - Xβ\|. \end{align*} $$ $\hat β$ solves the normal equation $$ \begin{align*} X^T(Y - X\hat β) = 0. \end{align*} $$
If $X$ has full rank, $X^T X$ is invertible, so $$ \begin{align*} \hat β = (X^T X)\inv X^T Y. \end{align*} $$
Let $μ = Xβ$. Then the least squares problem is equivalent to $$ \begin{align*} \hat μ = \arg\min_{μ\in \mathrm{Col}(X)} \|Y - μ\| \end{align*} $$ where $\mathrm{Col}(X)$ is the column space of $X$.
-
The fitted value $\hat μ$ is given by $$ \begin{align*} \hat μ = X\hat β = PY \end{align*} $$ where $$ \begin{align*} P = X(X^T X)\inv X^T \end{align*} $$ is the orthogonal projection matrix into $\mathrm{Col}(X)$.
-
The vector of residues is given by $$ \begin{align*} R = Y - \hat μ = (I - P)Y. \end{align*} $$
-
The residual sum of squares is $$ \begin{align*} \text{RSS} = \|R\|^2. \end{align*} $$
In the normal linear model, the maximum likelihood estimators for $β$ and $σ^2$ are $$ \begin{align*} \hat β_{\text{MLE}} ={}& \arg\min_{β\in \R^p} \|Y - Xβ\|, \\ \hat σ^2_{\text{MLE}} ={}& \frac{\text{RSS}}{n} =\frac{1}{n}\|Y - X\hat β_{\text{MLE}}\|^2 = \frac{1}{n}\min_{β\in \R^p} \|Y-Xβ\|^2. \end{align*} $$ The resulting maximum likelihood is $$ \begin{align*} L_{Y\mid X}(\hat β_{\text{MLE}}, \hat σ^2_{\text{MLE}}) = \left(\frac{2πe}{n}\mathrm{RSS}\right)^{-n/2}. \end{align*} $$
Assume $X$ has full rank.
In the linear conditional expectation model, the least square estimator $\hat β$ is the best linear unbiased estimator (BLUE), i.e. $\hat β$ is linear in $Y$, unbiased, and for any other linear unbiased estimator $\tilde β$, we have $\var \hat β$ $\preceq$ $\var \tilde β$ (which means $\var(a^T \hat β) \leq \var(a^T \tilde β)$).
A square matrix $P \in \R^{n\times n}$ is an orthogonal projection matrix if it is symmetric ($P^T = P$) and idempotent ($P^2=P$).
-
$P$ is a orthogonal projection matrix iff $P=UU^T$ where the columns of $U\in \R^{n\times \mathrm{rank}(P)}$ form an orthonormal basis for the column space of $P$. (Proof)
-
Eigenvalues of $P$ are either 0 or 1.
-
$\mathrm{rank}(P) = \tr(P)$.
-
$I-P$ is also an orthogonal projection matrix.
-
$\|Y\|^2 = \|PY\|^2 + \|(I - P)Y\|^2$ for any $Y\in \R^n$.
Suppose $ε\sim N(0, σ^2 I_n)$ and $P$ is an $n\times n$ orthogonal projection matrix. Then
-
$Pε \sim N(0, σ^2 P)$ and $(I_n-P)ε\sim N(0,σ^2(I_n-P))$ are independent; and
-
$\|Pε\|^2/σ^2 \sim χ^2_{\mathrm{rank}(P)}$.
In a normal linear model, assume $X$ is fixed and has full rank. Then maximum likelihood estimators
-
$\hat β_{\text{MLE}}$ and $\hat σ^2_{\text{MLE}}$ are independent;
-
$\hat β_{\text{MLE}} \sim N(β, σ^2(X^TX)\inv)$; and
-
$n\,\hat σ^2_{\text{MLE}}/σ^2 \sim χ_{n-p}^2$.
-
Since $\hat σ_{\text{MLE}}^2$ is biased ($\expect(\hat σ^2_{\text{MLE}}) = \frac{n-p}{n}σ^2$), it is more common to use the unbiased estimator $$ \begin{align*} \hat σ^2 = \frac{n}{n-p}\hat σ_{\text{MLE}}^2 = \frac{1}{n-p} \|Y - X\hat β_{\text{MLE}}\|^2. \end{align*} $$
The $F$-distribution with $d_1$ and $d_2$ degrees of freedom, denoted as $F_{d_1, d_2}$, is defined to be the distribution of $$ \begin{align*} R = \frac{S_1/d_1}{S_2/d_2} \end{align*} $$ where $S_1 \sim χ^2_{d_1}$ and $S_2\sim χ_{d_2}^2$ are independent.
-
If $T\sim$ $t_{d}$, then $T^2 \sim F(1, d)$.
Partition the design matrix $X = \pmat{X_0 & X_1}$ with $X_0 \in \R^{n\times p_0}, X_1 \in \R^{n\times (p-p_0)}$. Consider the nested models
Model |
Hypothesis |
Design |
Fitted values |
|---|---|---|---|
Saturated |
$μ\in \R^n$ |
$I_n$ |
$\hat μ = Y$ |
Full |
$μ\in \mathrm{colspan}(X)$ |
$X$ |
$\hat μ = PY$ |
Sub/Null |
$μ\in \mathrm{colspan}(X_0)$ |
$X_0$ |
$\hat μ = P_0Y$ |
where $P = X(X^T X)\inv X^T$ and $P_0 = X_0(X_0^T X_0)\inv X_0^T$.
If we partition $β = \pmat{β_0 \\ β_1}$ the same way ($β_0\in \R^{p_0}$, $β_{1}\in \R^{p-p_0}$), then the sub-model is saying $β_1 = \v 0$.
The size $α$ generalised likelihood ratio test for testing $H_0:$ sub-model vs $H_1:$ full model (minus sub-model) rejects $H_0$ if $$ \begin{align*} \frac{\|(P-P_0) Y\|^2 / (p-p_0)}{\|(I-P)Y\|^2/(n-p)} > F_{p-p_0, n-p}(α). \end{align*} $$ (Derivation)
The t-test for testing $H_0: β_j = β_{0j}$ against $H_1: β_j \neq β_{0j}$ (for some particular $j$) is to reject $H_0$ when $$ \begin{align*} \frac{|\hat β_{j,\text{MLE}} - β_{0j}|}{\sqrt{\hat σ^2{(X^T X)\inv}_{jj}}} > t_{n-p}(α/2) \end{align*} $$ where $\hat σ^2 = \frac{1}{n-p}\|Y - X\hat β_{\text{MLE}}\|^2$ is the unbiased estimator for $σ^2$. (Derivation)
This gives a $(1-α)$-confidence interval for $β_j$: $$ \begin{align*} \hat β_{j,\text{MLE}} \pm t_{n-p}(α/2) \sqrt{\hat σ^2 {(X^T X)\inv}_{jj}}. \end{align*} $$
We can rephrase this as nested models: $$ \begin{align*} Y - β_{0j} X_j = \pmat{X_1 & \ldots & X_j & \ldots & X_p} \pmat{β_1 \\ \vdots \\ β_{j} - β_{0j} \\ \vdots \\ β_{p}} + ε. \end{align*} $$ This is equivalent to the F-test for nested models. (Derivation: TODO)
The F-test for testing $H_0: β = β_0$ against $H_1: β\neq β_0$ is to reject $H_0$ when $$ \begin{align*} \frac{\|X(\hat β_{\text{MLE}} - β_0)\|^2/p}{\hat σ^2} > F_{p,n-p}(α) \end{align*} $$ where $\hat σ^2 = \frac{1}{n-p}\|Y - X\hat β_{\text{MLE}}\|^2$ is the unbiased estimator for $σ^2$.
This gives a $(1-α)$-confidence set for $β$ $$ \begin{align*} \sb{β\in \R^n}{\frac{\|X(\hat β_{\text{MLE}} - β)^2\|}{p\hat σ^2} \leq F_{p,n-p}(α)}, \end{align*} $$ which is an ellipsoid.
This is the F-test for nested models.
Model $$ \begin{align*} Y_{ij} = μ_i + ε_{ij} \end{align*} $$ where $j=1,\ldots,n_i$, $i=1,\ldots,k$ and the noise follows $ε_{ij} \sim N(0,σ^2)$. Want to test $H_0: μ_1 = \ldots = μ_k$ against $H_1: μ_1,\ldots,μ_k\in \R$ unrestricted, excluding $H_0$.
This is a nested model: $$ \begin{align*} Y = \underbrace{\pmat{\v 1_{n_1} \\ \v 1_{n_2} & \v 1_{n_2} \\ \vdots & & \ddots \\ \v 1_{n_k} & && \v 1_{n_k}}}_{X^{\text{full}}}\,\underbrace{\pmat{μ \\ μ_2-μ \\ \vdots \\ μ_k - μ}}_{β} + ε \end{align*} $$ with $$ \begin{align*} \hat μ^{\text{saturated}} = Y, \qquad \hat μ^{\text{full}} = \pmat{\overline{Y_{1+}} \v 1_{n_1} \\ \vdots \\ \overline{Y_{k+}} \v 1_{n_k}}, \qquad \hat μ^{\text{sub}} = \overline{Y_{++}} \v 1_{n}. \end{align*} $$ where $\overline{Y_{i+}} = \frac{1}{n_i}\sum_{j=1}^{n_i} Y_{ij}$ and $\overline{Y_{++}} = \frac{1}{n} \sum_{i=1}^{k} \sum_{j=1}^{n_i} Y_{ij}$.
We often form the ANOVA table
Source of variation |
Sum of squares |
Degrees of freedom |
Mean squares |
F-statistic |
|---|---|---|---|---|
Between groups |
$\mathrm{SSA} = \sum_{i=1}^{k} n_i(\overline{Y_{i+}} - \overline{Y_{++}})^2$ |
$k-1$ |
$\mathrm{MSA} = \mathrm{SSA}/(k-1)$ |
$\mathrm{MSA}/\mathrm{MSE}$ |
Within groups |
$\mathrm{SSE} = \sum_{i=1}^{k} \sum_{j=1}^{n_i} (Y_{ij} - \overline{Y_{i+}})^2$ |
$n-k$ |
$\mathrm{MSE} = \mathrm{SSE}/(n-k)$ |
|
- |
||||
Total |
$\mathrm{SST} = \sum_{i=1}^{k} \sum_{j=1}^{n_i} (Y_{ij} - \overline{Y_{++}})^2$ |
$n-1$ |
Therefore the F-test is $$ \begin{align*} \frac{\mathrm{MSA}}{\mathrm{MSE}} = \frac{\sum_{i=1}^{k} n_i (\overline{Y_{i+}} - \overline{Y_{++}})^2/(k-1)}{\sum_{i=1}^{k} \sum_{j=1}^{n_i} (Y_{ij} - \overline{Y_{i+}})^2/(n-k)} > F_{k-1,n-k}(α). \end{align*} $$