# Most powerful test of size zero for $\theta$ given random sample from $U(0, \theta)$

I found a couple of questions on this site (Most powerful test of simple vs. simple in $\mathrm{Unif}[0, \theta]$ and UMP for $U(0,\theta)$ (simple x simple hypothesis)) that are similar to my problem, but I don't understand enough about hypothesis testing to translate the discussion in those links to my situation.

Problem:

Let $$Y_1, \dots, Y_n$$ be a random sample from a uniform distribution on the interval $$[0, \theta]$$ where $$\theta > 0$$ is unknown. Find the most powerful test for the null hypothesis $$H_0 \colon \theta = 1$$ against the alternative hypothesis $$H_1 \colon \theta = 4$$ which never rejects a true null hypothesis. Find the power of this most powerful test when $$n = 4$$.

My attempt:

I initially considered the ratio of likelihoods $$\dfrac{L_{\boldsymbol{Y}}(\theta_1 ; \boldsymbol{Y})}{L_{\boldsymbol{Y}}(\theta_0 ; \boldsymbol{Y})}$$ but this didn't seem to lead anywhere. Then I decided to use the following test, based purely on intuition: reject $$H_0$$ if and only if the sample maximum $$Y_{(n)} > 1$$.

It is my understanding that this test is actually uniformly most powerful for the composite alternative $$H_1^{\prime} \colon \theta > 1$$ because the rejection region does not depend on the value of $$\theta_1$$ ($$4$$ in this case). Therefore the test must certainly be most powerful for the null and alternative hypotheses as stated in the problem.

I am pretty sure the test will never reject a true null hypothesis (i.e. has size zero) because, well, by construction it will only reject $$H_0$$ when the sample maximum is greater than $$1$$, which means that $$H_0$$ must be false.

As for the power of the test, I reason as follows (note that according to my course notes, the phrase "power of the test" refers to the value of the function $$\beta(\theta) = P( \text{reject } H_0)$$ in the situation that $$H_1$$ is true):

\begin{align} \text{Power of the test} &= P( \text{reject } H_0)\\ &= P( Y_{(n)} > 1)\\ &= 1 - F_{Y_{(n)}}(1)\\ &= 1 - \left( \frac{1}{4} \right)^{\!\!4} \text{ (plugging in d.f. of } Y_{(n)} \text{ when } n = 4 \text{ and } H_1 \text{ is true)}\\ &= \frac{255}{256}. \end{align}

Question:

Is this solution correct?

Thanks.

• For a large sample size, it probably doesn't matter, but $Y_{(n)}$ is a biased estimator of $\theta.$ $\hat\theta=(n+1)Y_{(n)}/n$ is unbiased, so it might be better to use $\hat\theta$ instead, particularly with lower sample sizes. Aug 18, 2021 at 17:35

Yes, it is correct. You can derive this test from the likelihood ratio. The likelihood $$L_\theta$$ is $$\theta^n$$ if all $$Y_i\leq\theta$$ and 0 otherwise, so the likelihood ratio is $$(1/4)^n$$ if all $$y_i\leq 1$$ and $$0$$ otherwise.
The most powerful test must choose $$\theta=1$$ if $$Y_{(n)}\leq 1$$ and $$\theta=4$$ otherwise, since those correspond to the only possible values of the likelihood ratio and as you show, this test has size zero and power 255/256.
• Zero. The test never rejects $\theta=1$ when it's true Aug 18, 2021 at 23:38