= Solution
Use the residual mean square
$$
\boxed{s^2=\frac{\|Y-X\widehat\theta\|^2}{n-p}.}
$$
To justify its denominator, let $H=X(X^TX)^{-1}X^T$, the <orthogonal projection matrix> onto the column space of $X$. Then the residual is $(I-H)\epsilon$. The <idempotent matrix> $I-H$ has rank $n-p$, so diagonalizing it with an <orthogonal matrix> gives
$$
\frac{\|Y-X\widehat\theta\|^2}{\sigma^2}\sim\chi^2_{n-p}.
$$
Consequently $\mathbb Es^2=\sigma^2$, making $s^2$ an <unbiased estimator>. If specifically asked for <maximum likelihood estimation>, maximizing over $\sigma^2$ gives the alternative $\widehat\sigma^2_{\rm ML}=\|Y-X\widehat\theta\|^2/n$, which is biased downward by the factor $(n-p)/n$.
Back to article page