# Neyman-Pearson hypothesis testing with uniform random variables

This question is quite simple. We have a random sample $$X_1, X_2, ..., X_n$$ from $$U(\theta, \theta + 1)$$ and we want to test $$H_0: \theta=0$$ vs $$H_0: \theta=\theta_1$$ for some $$0 < \theta_1 < 1$$. We want to use Neyman-Pearson's lemma to find the most powerful test. The likelihood-ratio is

$$\lambda = \frac{L_0}{L_1} = \frac{L(\theta_0 , x_1,x_2,...,x_n)}{L(\theta_1 , x_1,x_2,...,x_n)} = \frac{I_{(0, \infty)}(y_1)I_{(-\infty,1)}(y_n)}{I_{(\theta_1, \infty)}(y_1)I_{(-\infty,\theta_1 + 1)}(y_n)}$$, where $$y_1 = min(x_1,...,x_n)$$ and $$y_n = max(x_1,...,x_n)$$.

According to Neyman-Pearson, the most powerful test is $$\Lambda \leqslant k$$ for some $$k$$. If we want the test to have size $$\alpha$$ then we have to find $$k$$ such that $$P_{\theta = 0}(\Lambda \leqslant k) = \alpha$$.

If $$\theta = 0$$, $$\Lambda$$ equals just $$\frac{1}{I_{(\theta_1, \infty)}(y_1)}$$ so now we have to find $$k$$ such that $$P_{\theta = 0}(\frac{1}{I_{(\theta_1, \infty)}(y_1)} \leqslant k) = \alpha$$.

I don't know how to find such a $$k$$ and feel like I may be misunderstanding something.

• You will need to explore the possibility of data for which the likelihood under one hypothesis is $1$ and under the other hypothesis is $0.$ In these cases your expression for $\Lambda$ is undefined, so you had better not rely on it. – whuber May 6 '19 at 15:14
• So Neyman-Pearson's lemma is inapplicable in this situation? – Noppawee Apichonpongpan May 6 '19 at 16:40
• It has to be carefully interpreted in this situation. Consider rewriting the event $\Lambda \le k$ as $L_0 \le kL_1.$ – whuber May 6 '19 at 16:45
• Thank you, I will try that. – Noppawee Apichonpongpan May 6 '19 at 16:46
• I don't think the theorem asserts you can create a test of exactly the intended size--but you definitely can control it. – whuber May 7 '19 at 13:27

The likelihood ratio requires a bit more careful study here.

Pdf of the sample $$X_1,\ldots,X_n$$ is $$f_{\theta}(\mathbf x)=\prod_{i=1}^n \mathbf1_{\theta

I would define the ratio as $$\Lambda=f_{H_1}/f_{H_0}$$, for which I get the following cases:

\begin{align} \Lambda(\mathbf x)=\frac{f_{H_1}(\mathbf x)}{f_{H_0}(\mathbf x)}&=\frac{\mathbf1_{\theta_1\theta_1,1

By N-P lemma, you are to reject $$H_0$$ for large values of $$\Lambda$$. Can you give it a try now?

I found a similar exercise here that asks to prove that a UMP test for testing $$H_0:\theta\le 0$$ vs $$H_1:\theta>0$$ is of the form

$$\varphi(\mathbf x)=\begin{cases}1&,\text{ if }x_{(1)}\ge k\,\,\text{ or }\,\,x_{(n)}\ge 1 \\ 0&,\text{ otherwise }\end{cases}$$

, where $$k$$ can be easily found so that size of $$\varphi$$ is $$\alpha$$.

This is exercise 6.6.18 of Mathematical Statistics by Shao (page 456, 2nd edition).

If you can see this page, then maybe you can use this exercise to verify your final results.

• Thank you, you are wonderful. I am still digesting your answer. – Noppawee Apichonpongpan May 8 '19 at 15:08
• You should verify the expression for $\Lambda$ first of all and then proceed accordingly. – StubbornAtom May 8 '19 at 15:15
• I think I am supposed to use a randomised test, right? If $\theta_1 < x_{(1)}$ then I reject $H_0$ with some probability that makes the size of the test $\alpha$. – Noppawee Apichonpongpan May 8 '19 at 15:20
• @NoppaweeApichonpongpan No need for randomisation here. – StubbornAtom May 8 '19 at 21:25
• No randomisation? I thought I understood but now I am back to being confused. The test I got is ---- reject $H_0$ if $X_{(n)} > 1$ (in this case $Y_{(1)} > \theta_1$) ---- accept $H_0$ if $X_{(n)} < 1$ and $X_{(1)} < \theta_1$ ---- if $X_{(n)} < 1$ and $X_{(1)} > \theta_1$ then reject $H_0$ with probability $\frac{\alpha}{(1-\theta_0)^n}$ This test has size $\alpha$ and I think (but is not sure) is most powerful. Is this incorrect? – Noppawee Apichonpongpan May 9 '19 at 9:30