Solution (source code)

= Solution

The power of a test at a parameter value is its probability of rejecting the null there. Its size is the supremum of this probability over the null parameter set. The <Neyman-Pearson lemma> states that for simple null and alternative densities $f_0,f_1$, a test rejecting where $f_1>cf_0$, accepting where $f_1<cf_0$, and randomizing as needed on equality to attain size $\alpha$, has greatest power among tests of size at most $\alpha$.

The specified function is nonnegative. Its integral is
$$
\frac{\theta^2}{\theta+1}\left\{\int_0^\infty xe^{-\theta x}\,dx+\int_0^\infty e^{-\theta x}\,dx\right\}
=\frac{\theta^2}{\theta+1}\left(\theta^{-2}+\theta^{-1}\right)=1.
$$
For independent observations write $S=\sum_iX_i$. The <likelihood ratio> of the smaller alternative parameter to the null is
$$
\frac{L(\theta_1)}{L(\theta_0)}=
\left\{\frac{\theta_1^2(\theta_0+1)}{\theta_0^2(\theta_1+1)}\right\}^n
\exp\{(\theta_0-\theta_1)S\}.
$$
It is strictly increasing in $S$. Thus the most powerful level-$\alpha$ test rejects for
$$
\boxed{S>c_\alpha,\qquad\mathbb P_{\theta_0}(S>c_\alpha)=\alpha}.
$$
The continuous distribution permits this size without randomization for $0<\alpha<1$. Its threshold depends only on the null and the desired size, not on which $\theta_1<\theta_0$ was chosen. The same test is therefore \b[uniformly most powerful against the entire one-sided alternative $\theta<\theta_0$].