# how to get the critical region for a uniformly most powerful test for mean of normal?

I need help in understanding how to construct a uniformly most powerful test using the Neyman-Pearson lemma. Here is an excerpt in my text that I have trouble following: I have no idea how to get $(5.4)$. The fact that my text skips the steps seems to imply that this is something straightforward but I am still stumped. I also don't see the point of observing that the relationship between the likelihood ratio and $\bar{Y}$ when $\mu_0<\mu_1$ and $\mu_0>\mu_1$.

What I've tried

By the Newyman-Pearson lemma, I know that the critical region will satisfy :

$$L_\mathbf{Y}(\mu_1;\mathbf{Y}) - k_\alpha L_\mathbf{Y}(\mu_0;\mathbf{Y}))>0$$

where $k_\alpha$ is some constant that depends on the size of the test, $\alpha$,

This means:

$$\frac{L_\mathbf{Y}(\mu_1;\mathbf{Y})}{L_\mathbf{Y}(\mu_0;\mathbf{Y}))} > k_\alpha$$

So, using the given likelihood ratio, I have:

$$\exp\left\{\frac{n}{2\sigma^2}\left[(\mu_0-\mu_1)(\mu_0+\mu_1-2\bar{Y})\right]\right\} >k_\alpha$$

So, solving for $\bar{Y}$, I get:

$$\bar{Y} \lt -\frac{1}{2}\left[ \frac{\ln(k_\alpha)2\sigma^2-n(\mu_0^2-\mu_1^2)}{n(\mu_0-\mu_1)}\right]$$

I don't know how to proceed at this point. Also, so far I don't see how anything would change is assumed $\mu_0>\mu_1$ instead.

• Please add the self-study tag (you seem to already follow the guidelines at its tag wiki, but it wouldn't hurt to take a look at them) – Glen_b -Reinstate Monica Mar 22 '15 at 12:49

Let me use a slightly different but equivalent formulation in which the likelihood under the null is in the numerator, and hence we reject for small likelihood ratios.

Consider testing the version of the problem as stated in your screenshot, $H_0:\mu=\mu_0$ vs. $H_1:\mu=\mu_1$, where $\mu_1>\mu_0$ for a r.s. of size $n$ from a $N(\mu,1)$ population (if $\sigma^2$ is known, we may as well set it to 1 for simplicity).

We first show that, for a Neyman-Pearson cutoff value $k_\alpha$ for the likelihood ratio, the rejection region of the Neyman-Pearson test can be written in terms of $\bar{y}$ as $$\bar{y}>\frac{\ln k_\alpha-\frac{n}{2}(\mu_1^2-\mu_0^2)}{n(\mu_0-\mu_1)}\equiv K$$ The likelihood is
$$L(\mu;y)=\prod_i\frac{1}{\sqrt{2\pi}}e^{-\frac{(y_i-\mu)^2}{2}}=(2\pi)^{-\frac{n}{2}}e^{-\frac{\sum_i(y_i-\mu)^2}{2}}$$ Thus, \begin{align*} \lambda(y)&=\frac{L(\mu_0;y)}{L(\mu_1;y)}\\ &=\frac{(2\pi)^{-\frac{n}{2}}e^{-\frac{\sum_i(y_i-\mu_0)^2}{2}}}{(2\pi)^{-\frac{n}{2}}e^{-\frac{\sum_i(y_i-\mu_1)^2}{2}}}\\ &=e^{\frac{1}{2}[\sum_i(y_i^2-2\mu_1 y_i+\mu_1^2)-\sum_i(y_i^2-2\mu_0 y_i+\mu_0^2)]}\\ &=e^{(\mu_0-\mu_1)\sum_i y_i+\frac{1}{2}(n\mu_1^2-n\mu_0^2)}\\ &=e^{(\mu_0-\mu_1)n\bar{y}+\frac{n}{2}(\mu_1^2-\mu_0^2)}<k_\alpha\\ \end{align*} Then $$n(\mu_0-\mu_1)\bar{y}+\frac{n}{2}(\mu_1^2-\mu_0^2)<\ln k_\alpha\Rightarrow n(\mu_0-\mu_1)\bar{y}<\ln k_\alpha-\frac{n}{2}(\mu_1^2-\mu_0^2).$$ Hence $$\bar{y}\overset{\mu_0<\mu_1}{>}\frac{\ln k_\alpha-\frac{n}{2}(\mu_1^2-\mu_0^2)}{n(\mu_0-\mu_1)}\equiv K,$$ so I simply call the rhs of the inequality $K$ (which implicitly depends on $\alpha$ and $n$).

Here, you also see that whether the value under the alternative is higher or lower matters in that we divide the inequality by either a positive or a negative difference, so that the inequality sign reverses or not.

We next show that the critical value $K$ is such that $$K=\mu_0+\frac{z_{(1-\alpha)}}{\sqrt{n}},$$ where $z_{(1-\alpha)}$ is the $1-\alpha$ quantile of the standard normal distribution. The key thing to note here is that the critical region has to have size $\alpha$ (just another way of saying we want a level-$\alpha$ test, so reject a true null in 5% of the cases, so want a probability that our test statistic $\bar{y}$ is larger than the $K$ of 5% under the null).

Under the null, we have $$\bar{y}\sim N\left(\mu_0,\frac{1}{n}\right)\Rightarrow \frac{\bar{y}-\mu_0}{\sqrt{1/n}}\sim N(0,1)$$ Hence, $K$ needs to be such that, when the null is true,
\begin{align*} &P(\bar{y}>K)=\alpha\\ \Rightarrow & P\left(\frac{\bar{y}-\mu_0}{\sqrt{1/n}}>\frac{K-\mu_0}{\sqrt{1/n}}\right)=\alpha\\ \Rightarrow & \frac{K-\mu_0}{\sqrt{1/n}}=z_{(1-\alpha)}\\ \Rightarrow &K=\mu_0+\frac{z_{(1-\alpha)}}{\sqrt{n}} \end{align*} Here, the 2nd-to-last line follows because $z_{(1-\alpha)}$ is, by definition, the value that is exceeded with probability $\alpha$ for a $N(0,1)$-r.v.