# Prove test is UMP for $H_{0}: \theta = \theta_{0}$ against $H_{1}: \theta \neq \theta_{0}$ for $\rm Unif(0, \theta).$

Let $$X_1, \dots ,X_n$$ be an i.i.d. sample from $$\rm Unif(0, \theta)$$. Consider testing $$H_{0}: \theta = \theta_{0}$$ against $$H_{1}: \theta \neq \theta_{0}$$. Show that an uniform most powerful (UMP) test is given by

\begin{align*} \delta(x) = \begin{cases} 1 & x_{(n)} > \theta_{0} \text{ or }x_{(n)} < \theta_{0}(\alpha)^{1/n}\\ 0 & \text{otherwise}\\ \end{cases} \end{align*}

where $$x_{(n)}$$ is the $$n$$-th order statistic.

First, $$\mathbb{E}_{\theta_{0}}[\delta(X)] = \underbrace{P(x_{(n)} > \theta_{0})}_{=0} + P(x_{(n)} < \theta_{0}(\alpha)^{1/n}) = \left(\frac{\theta_{0}\alpha^{1/n}}{\theta_{0}}\right)^{n} = \alpha$$, showing $$\delta(x)$$ is a level $$\alpha$$ test.

It remains to be shown that $$\delta(x)$$ has superior power over any other test $$\phi(x)$$ with level $$\alpha$$. In other words, $$\mathbb{E}_{\theta_{1}}[\delta(x) - \phi(x)] \geq 0$$.

We can partition by whether $$x_{(n)}$$ falls in acceptance or rejection regions

$$\mathbb{E}_{\theta_{1}}[\delta(x) - \phi(x)] = \mathbb{E}_{\theta_{1}}[(\delta(x) - \phi(x))1(\theta_{0}\alpha^{1/n} \leq x_{(n)} \leq \theta_{0})] + \mathbb{E}_{\theta_{1}}[(\delta(x) - \phi(x))1(x_{(n)} \in (-\infty, \theta_{0}\alpha^{1/n}) \cup (\theta_{0}, \infty))].$$

The second term is nonnegative because $$\delta(x) = 1$$ and $$\phi(x) \leq 1$$. The problem comes, in proving the first term is nonnegative. Below is an attempt:

\begin{align*} \mathbb{E}_{\theta_{1}}[(\delta(x) - \phi(x))1(\theta_{0}\alpha^{1/n} \leq x_{(n)} \leq \theta_{0})] = \underbrace{\frac{1}{\theta_{1}^{n}}}_{> 0}\underbrace{\int(\delta(x) - \phi(x))1(\theta_{0}\alpha^{1/n} \leq x_{(n)} \leq \theta_{0})dx}_{=h(\delta, \phi, \theta_{0})} \end{align*}

Thus, it is sufficent to show $$h(\delta, \phi, \theta_{0}) > 0$$. One trick strategy is to show that under $$\theta_{0}$$

\begin{align*} \frac{1}{\theta_{0}^{n}}h(\delta, \phi, \theta_{0}) &= \mathbb{E}_{\theta_{0}}[(\delta(x) - \phi(x))1(\theta_{0}\alpha^{1/n} \leq x_{(n)} \leq \theta_{0})]\\ &= \underbrace{\mathbb{E}_{\theta_{0}}[\delta(x)]}_{=\alpha} - \underbrace{\mathbb{E}_{\theta_{0}}[\phi(x)]}_{\leq \alpha}\\ &\geq 0 \end{align*}

However, the second equality above seems to be false, because by definition of $$\delta(x)$$, $$\delta(x) = 0$$ when $$\theta_{0}\alpha^{1/n} \leq x_{(n)} \leq \theta_{0}$$, so $$\mathbb{E}_{\theta_{0}}[\delta(x)] = 0$$ instead. Can anyone resolve this?

• See math.stackexchange.com/q/1736322/321264. The 'and' in $\delta(x)$ should be 'or'. Jun 8, 2020 at 6:09
• Correct, thank you. Jun 8, 2020 at 8:21

If there is a UMP test it must agree with the most powerful test against any specific $$\theta=\theta_a$$ given by the Neyman-Pearson Lemma, which is based on the likelihood ratio between those two point hypotheses.
For this problem, the likelihood ratio for $$\theta_a$$ vs $$\theta_0$$ depends only on $$x_{(n)}$$, and is of the form you specify, so you just need to check that it has the right level, which you have done.