F-test

F-distribution open_in_new

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)

t-test for one parameter in linear model open_in_new

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)

F-test for all parameters in linear model open_in_new

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.

Analysis of variance open_in_new

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*} $$