Solution (source code)

= Solution

Under the null, $R=(I-P_0)\varepsilon$, so $R/\sigma\stackrel d=(I-P_0)Z$ for $Z\sim N(0,I)$.