Solution (source code)

= Solution

The full parameter space has dimension two and the null space dimension one. The regular <Wilks theorem> therefore gives $W\xrightarrow d\chi_1^2$ under $H_0$ as $n\to\infty$. If $F_1$ denotes the <cumulative distribution function> of the <chi-squared distribution> with one degree of freedom, the approximate size-$\alpha$ <rejection region> is
$$
\boxed{q-n-n\log(q/n)\geq F_1^{-1}(1-\alpha)}.
$$
The corresponding approximate <p-value> is
$$
\boxed{1-F_1\!\left(q_{\mathrm{obs}}-n-n\log(q_{\mathrm{obs}}/n)\right)}.
$$
The one degree of freedom here describes the large-sample <likelihood-ratio test statistic>; it is different from the exact residual degrees of freedom $n-1$ in the next part.