IB Statistics
Recall common discrete and continuous distributions in IA Probability.
Suppose data $X\in \mathcal{X}$ follows a probability distribution $p(x; θ)$ where a parameter $θ\in Θ$ is unknown.
An estimator is a statistic (function on the data) $\hat θ: \mathcal{X} \to Θ$ which is used to approximate the true parameter $θ$.
The distribution of $\hat θ = \hat θ(X)$ is its sampling distribution.
The bias of an estimator $\hat θ$ for $θ$ is $$ \begin{align*} \op{bias}(\hat θ) = \expect_θ(\hat θ) - θ, \end{align*} $$ which is a function of $θ$.
We say $\hat θ$ is unbiased if $\op{bias}(\hat θ) = 0$ for all $θ\in Θ$.
The mean square error of an estimator $\hat θ$ for $θ$ is $$ \begin{align*} \op{MSE}(\hat θ) = \expect_θ\bigl((\hat θ-θ)^2\bigr), \end{align*} $$ which is a function of $θ$.
If $T(X)$ is a sufficient statistic and in two experiments with data $x$ and $y$ we have $T(x) = T(y)$, then the "evidence" about $θ$ given the two experiments is the same.
A statistic $T = T(X)$ is said to be sufficient for $θ$ if the conditional distribution of $X$ given $T(X)$ does not depend on $θ$.
Suppose $X$ follows a distribution $p(x; θ)$ depending on an unknown parameter $θ$.
A statistic $T$ is sufficient for $θ$ iff $$ \begin{align*} p(x; θ) = g(T(x), θ)\, h(x) \end{align*} $$ for some functions $g$ and $h$.
A sufficient statistic $T(X)$ is minimal sufficient if it is a function of every other statistic, i.e. if $S(X)$ is a sufficient statistic, then $S(x) = S(y) \implies T(x) = T(y)$ for all $x,y\in \mathcal{X}$.
-
Minimal sufficient statistics are unique up to a bijection.
Suppose $T$ is a statistic, satisfying that $T(x) = T(y)$ iff $p(x; θ)/p(y; θ)$ does not depend on $θ$. Then $T$ is minimal sufficient.
-
If the range of $X$ depends on $θ$, the condition means $p(x;θ) = c(x,y)p(y;θ)$ for some $c(x,y)$.
Suppose $T$ is a sufficient statistic.
For any estimator $\tilde θ$ of $θ$, let $\hat θ = \expect_θ(\tilde θ\mid T)$ be another estimator. Then $$ \begin{align*} \op{MSE}(\hat θ) \leq \op{MSE}(\tilde θ) \end{align*} $$ with equality iff $\tilde θ$ is a function of $T$.
-
This reinforces the sufficiency principle: we should only consider estimators that are functions of sufficient statistics, since otherwise we can always make a better one.
The likelihood of $θ$ at the observed data $X$ is $L_X: θ \mapsto p(X; θ)$, viewed as a function of $θ$.
The maximum likelihood estimator (MLE) of $θ$ is the value of $θ$ that maximises $L_X$, i.e. $$ \begin{align*} \hat θ_{\text{MLE}} = \arg\max_{θ\in Θ} L_X(θ), \end{align*} $$ which is an estimator for $θ$ (a function of $X$).
Properties:
-
$\hat θ_{\text{MLE}}$ is a function of any sufficient statistic. (Derivation)
-
Under a bijection $h$, the MLE for $η = h(θ)$ is $\hat η_{\text{MLE}} = h(\hat θ_{\text{MLE}})$.
-
Under certain conditions, the MLE is asymptotically normal: $\sqrt{n}(\hat θ_{\text{MLE}} - θ) \xrightarrow{d} N(0, I\inv)$ where $I$ is the Fisher information matrix.
All information about $θ$ obtained from an experiment with data $X$ is contained in the likelihood function of $θ$ given $X$.
This is stronger than the sufficiency principle.
Let $α\in [0,1]$
For $Θ\subseteq \R$, a $(1-α)$-confidence interval for $θ$ is a random interval $[L(X), U(X)] \subseteq Θ$ such that $$ \begin{align*} \prob_θ(L(X) \leq θ \leq U(X)) = 1-α \qquad \forall θ\in Θ. \end{align*} $$
For $X$ following $p(x; θ,η)$ with a unknown primary parameter $θ\in Θ$ and a unknown nuisance parameter $η\in H$, a $(1-α)$-confidence set/region of $θ$ is a random set $S(X) \subseteq Θ$ such that $$ \begin{align*} \prob_θ(θ\in S(X)) = 1-α \qquad \forall θ\in Θ,\ η\in H. \end{align*} $$
-
Frequentist interpretation: if we repeat the experiment many times, on average $100(1-α)\%$ of time the interval $[L(X), U(X)]$ covers $θ$.
-
Some authors only require $\geq 1-α$.
-
If $[L(X), U(X)]$ is a $(1-α)$-confidence interval for $θ$ and $h: Θ\to \R$ is monotone increasing, then $[h(L(X)), h(U(X))]$ is a $(1-α)$-confidence interval for $h(θ)$.
Frequentists treat $θ$ as a fixed quantity, while Bayesians treat $θ$ as a probabilistic distribution on $Θ$ and view statistical inference as updating one's belief about $θ$.
Suppose initially we have a prior distribution $π(θ)$. After observing data $X=x$, the posterior distribution of $θ$ is given by Bayes' theorem $$ \begin{align*} \underbrace{π(θ\mid x)}_{\text{posterior}} = \frac{π(θ)\,p(x\mid θ)}{p(x)} \propto \underbrace{p(x\mid θ)}_{\text{likelihood}}\,\underbrace{π(θ)}_{\text{prior}}. \end{align*} $$
$π(θ\mid x)$ can be a probability distribution even if the function $π$ may not. In this case we say $π$ is an improper prior.
The prior predictive distribution is the marginal distribution of $X$ $$ \begin{align*} π(x) = \int_{Θ} p(x\midθ) \,π(θ) \d θ \end{align*} $$ and the posterior predictive distribution is the conditional distributional of an iid copy $X'$ given $X$ $$ \begin{align*} π(x'\mid x) = \int_{Θ} p(x'\mid θ) \, π(θ\mid x)\d θ. \end{align*} $$
We say a family of prior distributions is conjugate to a likelihood model if the posterior distribution is in the same family.
-
Bayesian obeys the likelihood principle and thus the sufficiency principle. (Derivation)
Given some loss function $L: Θ\times Θ \to \R$, the Bayes risk of an estimator $\tilde θ$ for $θ$ is $$ \begin{align*} R_X(\tilde θ) = \expect_π(L(θ, \tilde θ)\mid X) = \int_{Θ} L(θ, \tilde θ(X))\, π(θ\mid X) \d θ. \end{align*} $$
The Bayes estimator is $$ \begin{align*} \hat θ(X) = \arg\min_{\tilde θ} R_X(\tilde θ). \end{align*} $$
-
The Bayes estimator with the quadratic loss $L(θ, \tilde θ) = (θ - \tilde θ)^2$ is the posterior mean. (Derivation)
-
The Bayes estimator with the absolute loss $L(θ, \tilde θ) = |\tilde θ - θ|$ is the posterior median. (Derivation)
A $(1-α)$-credible interval for $θ$ is a random interval $[L(X), U(X)]$ such that $$ \begin{align*} π(L(X) \leq θ \leq U(X)\mid X) = 1-α. \end{align*} $$
A hypothesis is an assumption about the distribution of the data $X$.
A simple hypothesis specifies the distribution of $X$ completely (e.g. parameter is a fixed value), and otherwise it is composite.
-
A test for a null hypothesis $H_0$ against an alternative hypothesis $H_1$ is a binary-valued statistic $T(X) \in \set{0,1}$, where
-
$T(X) = 1$ means we reject $H_0$ as the data contains enough evidence against $H_0$; and
-
$T(X) = 0$ means we do not reject $H_0$ as the data contains not enough evidence against $H_0$.
-
-
The power function of the test is $β(T; θ) = \prob_θ(T(X) = 1)$, the probability of rejection under $θ$.
-
The type I error rate is $β(T; θ)$ for $θ\in Θ_0$, the rate of "false rejection".
-
The type II error rate is $1-β(T; θ)$ for $θ\in Θ_1$, the rate of "false acceptance".
-
The size of the test is $\sup_{θ\in Θ_0} β(T; θ)$, the largest type I error rate.
A test $T: \mathcal{X}\to \set{0,1}$ is said to be the uniformly most powerful (UMP) size $α$ test for testing $H_0: θ\in Θ_0$ against $H_1: θ\in Θ_1$ if
-
it has size $α$, i.e. $\sup_{θ\in Θ_0} β(T, θ) = α$; and
-
for any other test $\tilde T$ with size at most $α$, we have $β(T, θ) \geq β(\tilde T, θ)$ for all $θ\in Θ_1$.
Suppose the data $X$ follows $p(x; θ)$ where $θ$ is unknown. Let $H_0$$: θ = θ_0$ and $H_1$$: θ = θ_1$ be simple hypotheses.
The likelihood ratio statistic is $$ \begin{align*} Λ(X) = \frac{L_X(θ_1)}{L_X(θ_0)} = \frac{p(X; θ_1)}{p(X; θ_0)} \end{align*} $$ where $L_X$ is the likelihood function.
A likelihood ratio test is a test of the form $$T(X) = 1_{\set{Λ(X) > c}}.$$
Suppose the data $X$ follows $p(x; θ)$ where $θ$ is unknown. Let $H_0$$: θ = θ_0$ and $H_1$$: θ = θ_1$ be simple hypotheses.
Assume $p(x; θ_0)$ and $p(x; θ_1)$ have the same support, i.e. are non-zero on the same set. Suppose there exists $c>0$ such that the likelihood ratio test $T^\ast(X) = 1_{\set{Λ(X) > c}}$ has size exactly $α$.
Then $T^\ast$ is uniformly most powerful, i.e. $T^\ast$ maximises $β(T; θ_1)$ subject to $β(T; θ_0)\leq α$.
Suppose the data $X$ follows $p(x; θ)$ where $θ$ is unknown. Let $H_0$$: θ \in Θ_0$ and $H_1$$: θ \in Θ_1$ be hypotheses.
The generalised likelihood ratio statistic is $$ \begin{align*} Λ(X) = \frac{\sup_{θ\in Θ_0 \cup Θ_1} L_X(θ)}{\sup_{θ\in Θ_0} L_X(θ)} = \frac{\sup_{θ\in Θ_0\cup Θ_1} p(X; θ)}{\sup_{θ\in Θ_0} p(X; θ)}. \end{align*} $$
A generalised likelihood ratio test is a test of the form $$ \begin{align*} T(X) = 1_{\set{Λ(X) > c}}. \end{align*} $$
Suppose $Θ_0\subseteq Θ_1$, and let $Λ(X)$ be the generalised likelihood ratio test for testing $H_0: θ\in Θ_0$ against $H_1: θ\in Θ_1\setminus Θ_0$.
Under regularity conditions, we have $$ \begin{align*} 2\log Λ(X) \xrightarrow{d} χ_{d_1-d_0}^2 \quad \text{as $n\to \infty$ under $H_0$} \end{align*} $$ where $d_1, d_0$ are the degrees of freedom (number of free parameters) of $H_1$ and $H_0$.
Let $T(X) = 1_{\set{Λ(X) > c}}$ be a test for testing $H_0: θ\in Θ_0$ against $H_1: θ\in Θ_1$.
The p-value statistic is defined as $$ \begin{align*} P = \sup_{θ\in Θ_0} \prob_θ(Λ(\tilde X) > Λ(X) \mid X) \end{align*} $$ where $\tilde X$ is an iid copy of $X$ (i.e. $\tilde X\sim p(x; θ)$ and independent of $X$).
-
If $T$ has size $α$, then $T = 1_{\set{P \leq α}}$. (Derivation)
Suppose $X\sim p(x; θ)$ where $θ\in Θ$ is unknown. Consider $T: Θ\times \mathcal{X}\to \set{0,1}$ and $I: \mathcal{X}\to \mathcal{P}(Θ)$ satisfying $$ \begin{align*} I(X) = \sb{θ\in Θ}{T(θ, X) = 0} \end{align*} $$ or equivalently $$ \begin{align*} T(θ, X) = \mathbb{1}_{\set{θ\not\in I(X)}}. \end{align*} $$
The following are equivalent:
-
$T(θ_0, X)$ is a size $α$ test for $H: θ=θ_0$ for all $θ_0\in Θ$.
-
$I(X)$ is a $(1-α)$-confidence set for $θ$.
Often for $Λ$ the generalised likelihood ratio statistic, we obtain $$ \begin{align*} 2\log Λ = 2\sum_{i} O_i \log \frac{O_i}{E_i} \end{align*} $$ where $O_i$ and $E_i$ are the observed and expected counts of $i$, satisfying $\sum_{i} O_i = \sum_{i} E_i$.
Pearson's chi-squared statistic is the approximation $$ \begin{align*} 2\log Λ \approx \sum_{i} \frac{(O_i - E_i)^2}{E_i} \end{align*} $$ valid when $(O_i - E_i)/E_i \approx 0$. (Derivation)
By Wilks' theorem, $2\log Λ \xrightarrow{d} χ^2_d$ under $H_0$ with a certain degree of freedom $d$. So the size $α$ Pearson's chi-squared test rejects $H_0$ if $$ \begin{align*} \sum_{i} \frac{(O_i - E_i)^2}{E_i} > χ^2_d(α). \end{align*} $$
Suppose $(N_1, \ldots, N_k) \sim \mathrm{Multinomial}(n; p_1, \ldots, p_k)$. Test $H_0: p=p_0(θ)$ for some $θ$ against $H_1: p_i$ unrestricted (but still $p_i\geq 0$ and $\sum_{i} p_i=1$), excluding $H_0$.
Apply Pearson's chi-squared test with $$ \begin{align*} O_i = N_i, \qquad E_i = np_{0i}(\hat θ_{\text{MLE}}), \qquad d = k-1-\op{df}(H_0). \end{align*} $$ where $\hat θ_{\text{MLE}}$ is the maximum likelihood estimator for $θ$ under $H_0$ and $\op{df}(H_0)$ is the degree of freedom of $H_0$. (Derivation)
Suppose $(X_1, Y_1), \ldots, (X_n, Y_n) \sim P$ iid, with $X_1\in (1,2,\ldots,r)$ and $Y_1\in (1,2,\ldots,c)$. Test $H_0: X_1$ and $Y_1$ are independent.
Summarise data by a contingency table with entries $N_{xy} = \sum_{i=1}^{n} \mathbb{1}_{\set{X_i = x, Y_i = y}}$. Model as $$ \begin{align*} (N_{11}, \ldots, N_{1c}, \ldots, N_{r1}, \ldots, N_{rc}) \sim \mathrm{Multinomial}(n; p_{11}, \ldots, p_{1c}, \ldots, p_{r 1}, \ldots, p_{rc}). \end{align*} $$ Now
-
$H_0$: $p_{xy} = p_{x+} p_{+y}$ where $p_{x+}, p_{+y}\geq 0$, $\sum_{x} p_{x+} = 1 = \sum_{y} p_{+y}$
-
$H_1$: $p_{xy}$ unrestricted (but still $p_{xy} \geq 0$, $\sum_{x,y} p_{xy} = 1$), excluding $H_0$.
Apply Pearson's chi-squared test with $$ \begin{align*} O_{xy} = N_{xy}, \qquad E_{xy} = \frac{N_{x+} N_{+y}}{n}, \qquad d=(r-1)(c-1). \end{align*} $$ (Derivation)
Now for each row $x$, we make a fixed number $n_x$ of samples. Model as $$ \begin{align*} (N_{x1}, \ldots, N_{xc}) \sim \mathrm{Multinomial}(n_x; p_{1\mid x}, \ldots, p_{c\mid x}). \end{align*} $$ Test $H_0:p_{y\mid x}$ does not depend on $x$ against $H_1: p_{y\mid x}$ unrestricted (but still $p_{y\mid x}\geq 0$ and $\sum_{y} p_{y\mid x} = 1$), excluding $H_0$.
The test is the same as the test for independence. (Derivation)
Suppose $X_1, \ldots, X_n \sim N(μ, σ^2)$ iid.
-
If $μ$ is unknown but $σ^2$ is known, then a minimal sufficient statistic is $\overline{X} = \frac{1}{n}\sum_{i=1}^{n} X_i$.
-
If both $μ$ and $σ^2$ are unknown, then a minimal sufficient statistic is $(\sum_{i} X_i, \sum_{i} X_i^2)$ (or under a bijection, $(\overline{X}, S_{XX})$).
Suppose $X_1, \ldots, X_n \sim N(μ,σ^2)$ iid, and let $$ \begin{align*} \overline{X} = \frac{1}{n}\sum_{i=1}^{n} X_i, \qquad S_{XX} = \sum_{i=1}^{n} (X_i - \overline{X})^2. \end{align*} $$
Then $\overline{X} \sim N(μ, σ^2/n)$ and $S_{XX}/σ^2 \sim χ^2_{n-1}$ are independent.
The maximum likelihood estimator for $μ$ is $$ \begin{align*} \hat μ_{\text{MLE}} = \overline{X} := \frac{1}{n}\sum_{i=1}^{n} X_i \end{align*} $$ regardless of whether $σ^2$ is known. This is unbiased.
The maximum likelihood estimator for $σ^2$ is $$ \begin{align*} \hat σ^2_{\text{MLE}} = \frac{S_{XX}}{n} := \frac{1}{n}\sum_{i=1}^{n} (X_i - \overline{X})^2. \end{align*} $$ This is biased in a finite sample but asymptotically unbiased: $\expect(\hat σ^2_{\text{MLE}}) = \frac{n-1}{n}σ^2$.
Suppose $μ$ is unknown but $σ^2$ is known.
A $(1-α)$-confidence interval is $$ \begin{align*} \left[\overline{X} - \frac{σz_{α_1}}{\sqrt{n}},\; \overline{X} + \frac{σz_{α_2}}{\sqrt{n}}\right] \end{align*} $$ where $α_1 + α_2 = α$. (Derivation)
-
Choose $α_1 = α_2 = α/2$ for an interval centred around the point estimator $\overline{X}$.
-
For $α=0.05$, $z_{α/2}\approx 1.96$, so the confidence interval is $\overline{X} \pm 1.96\, σ/\sqrt{n}$.
Suppose $μ$ is unknown but $σ^2$ is known.
The conjugate prior is $μ\sim N(μ_0, λ_0\inv)$ where $μ_0\in \R$ and $λ_0>0$ are given. After observing $X_1, \ldots, X_n \sim N(μ, λ\inv)$, the posterior distribution is $$ \begin{align*} μ\mid X \sim N\biggl(\frac{λ_0 μ_0 + nλ\overline{X}}{λ_0 + nλ}, \frac{1}{λ_0 + nλ}\biggr). \end{align*} $$ (Derivation)
Suppose $σ^2$ is known.
-
The likelihood ratio test for testing $H_0: μ=μ_0$ against $H_1: μ=μ_1$ where $μ_1 > μ_0$ is the one-sided z-test: reject $H_0$ if $$ \begin{align*} Z := \frac{\sqrt{n}(\overline{X} - μ_0)}{σ} > z_α \end{align*} $$ where $z_α$ is the upper $α$ quantile of the standard normal distribution.
By the Neyman-Pearson lemma, the z-test is the size $α$ uniformly most powerful test. (Derivation)
Proposition (one-tailed z-test is UMP) open_in_newThe z-test is uniformly most powerful for testing $H_0: μ\leq μ_0$ against $H_1: μ>μ_0$ in the normal location problem.
-
The generalised likelihood ratio test for testing $H_0: μ = μ_0$ against $H_1: μ\neq μ_0$ is the two-sided z-test: reject $H_0$ if $$ \begin{align*} |Z| > z_{α/2}. \end{align*} $$ (Derivation) This is the UMP unbiased test.
The t-distribution with $k$ degrees of freedom, denoted as $t_k$, is defined as the distribution of $$ \begin{align*} T = \frac{Z}{\sqrt{Y/k}} \end{align*} $$ where $Z\sim N(0,1)$ and $Y \sim χ_k^2$ are independent.
It has a density function $$ \begin{align*} p(x) = \frac{Γ(\frac{k+1}{2})}{\sqrt{πk}\, Γ(\frac{k}{2})} \left(1+\frac{x^2}{k}\right)^{-(k+1)/2}. \end{align*} $$
-
$t_1$ is the Cauchy distribution.
-
$t_k \xrightarrow{d} N(0,1)$ as $k\to \infty$.
-
The tail behaves like $x^{-(k+1)}$, so moments $\expect(|X|^m)<\infty$ only for $0< m<k$.
Suppose $μ$ and $σ^2$ are both unknown.
Student's t-statistic for the hypothesis $H_0: μ = μ_0$ is given by $$ \begin{align*} T = \frac{\sqrt{n}(\overline{X} - μ_0)}{\sqrt{S_{XX}/(n-1)}}. \end{align*} $$ $T\sim$ $t_{n-1}$, since $\sqrt{n}(\overline{X} - μ_0)/σ \sim N(0,1)$ and $S_{XX}/σ^2 \sim χ_{n-1}^2$ are independent.
-
One-sided $t$-test: to test $H_0: μ\leq μ_0$ against $H_1: μ>μ_0$, reject $H_0$ if $$ \begin{align*} T > t_{n-1}(α) \end{align*} $$ where $t_{n-1}(α)$ is the upper $α$ quantile of $t_{n-1}$.
-
Two-sided $t$-test: to test $H_0: μ=μ_0$ against $H_1: μ\neq μ_0$, reject $H_0$ if $$ \begin{align*} |T| > t_{n-1}(α/2). \end{align*} $$
This is generalised in a normal linear model.
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*} $$