Solution (source code)

= Solution

With $P_0=X_0(X_0^TX_0)^{-1}X_0^T$, $\hat\beta_0=(X_0^TX_0)^{-1}X_0^TY$ and $\hat\sigma^2=\|(I-P_0)Y\|^2/n$.