# Using Neyman Pearson lemma on a two sample test for normal means

Say I have two groups. I collect $$n$$ data points from the first ($$A$$) group ($$x_i$$) and $$m$$ data points from the second ($$B$$) group ($$y_j$$). The null hypothesis is that the means of the two groups are the same.

$$H_0: \mu_B = \mu_A$$ $$=> \mu_B-\mu_A=0$$ The alternate hypothesis is that the mean of group $$B$$ is larger than the mean of group $$A$$ by some effect size, $$e$$. $$H_1: \mu_B=\mu_A+e$$ $$=>\mu_B-\mu_A=e$$

I'll assume that the variances of the two groups are the same. I want to use the Neyman Pearson lemma to show that the test statistic that will yield the most power is the one used in the two-sample t-test (or the Wald test). I've been unable to do this and wanted to see if someone can help.

My attempt:

In a similar theme to the example provided in the Wikipedia article, I first construct the likelihood function:

$$L(\mu_B, \mu_A | x_i, y_j) \propto \exp\left( -\sum_i(x_i-\mu_A)^2 - \sum_j(y_j-\mu_B)^2\right)$$ $$\propto \exp\left(-\left(\sum x_i^2 + \sum y_j^2\right)-2\left(\mu_A \sum x_i+\mu_B\sum y_j\right) +(\mu_A^2+\mu_B^2)\right)$$

Now it seems like when I take the likelihood ratio for the two hypotheses, everything will cancel and the ratio will depend only on $$\sum y_j$$. This is obviously not right. Where did I go wrong?

• The likelihood is a function of $(\mu_A,\mu_B)$ not $\mu_a-\mu_B$. Dec 13, 2021 at 9:39
• Makes sense, updated. Dec 13, 2021 at 19:53
• The common (unknown) variance must make an appearance in the formulas for the likelihood.
– whuber
Dec 13, 2021 at 20:06
• Instead of parameterizing the model in terms of $\mu_A$ and $\mu_B$ can you parameterize it in terms of $\mu_A$ and $\theta$ where $\theta\equiv\mu_B-\mu_A$? Dec 13, 2021 at 20:11
• Everything cancels if one uses the same parameter values top and bottom. You have to use different parameters top and bottom, eg $(\mu_B, \mu_A)$ and $(\mu_B^\prime, \mu_A^\prime)$. And maximise top and bottom separately under both hypotheses (for the generalised likelihood ratio test, not Neyman-Pearson). Dec 14, 2021 at 5:40