# Hypothesis Testing a normally distributed random variable

I have a question that I am confused by.

Suppose I have a normally distributed random variable $Y$, with mean $\mu$ and variance $\sigma^2$, and I'm testing a null hypothesis of mean $= \mu_1$ and variance $= \sigma_1^2$ for some values $\mu_1$ and $\sigma_1$.

Then suppose my alternative hypothesis is mean $= \mu_2$ and variance $= \sigma_2^2$, for some values $\mu_2$ and $\sigma_2$. How can I do a hypothesis test to test these null and alternative hypotheses, respectively? Thank you very much in advance!

• If the standard deviation is known, a 1-sample $Z$-test might do the trick.
– 高田航
Jul 3, 2017 at 16:44
• The fact that the alternative hypothesis specifies a different variance complicates things. Jul 3, 2017 at 16:45
• You have a random variable $Y$. Often in these problems one considers a sequence of independent random variables $Y_1,\ldots,Y_n.$ Might you have had the latter in mind? Jul 3, 2017 at 17:03
• I've deleted my answer. I will edit it and put it back in edited form within a couple of days. Jul 7, 2017 at 0:42
• And now I've restored it after drastic edits. My earlier version was more complicated than it needed to be. Jul 7, 2017 at 1:20

You have $Y\sim N(\mu,\sigma^2)$ and the null and alternative hypotheses say $(\mu,\sigma) = (\mu_i,\sigma_i^2)$ for $i=1,2$ respectively.

Let $y$ be the observed value of $Y.$ The likelihood function is $$L(i) = \text{constant} \times \frac 1 {\sigma_i} \exp \left( \frac{-(y-\mu_i)^2}{2\sigma_i^2} \right) \text{ for } i = 1,2.$$

Let $A\sim B$ mean that any change in $y$ that makes $A$ bigger also makes $B$ bigger and vice-versa.

For now assume $\sigma_1>\sigma_2$; then make the appropriate changes if the opposite holds.

The likelihood ratio is \begin{align} \frac{L(1)}{L(2)} & = \frac{\sigma_2 \exp\left( \dfrac{-(y-\mu_1)^2}{2\sigma_1^2} \right)}{\sigma_1 \exp \left( \dfrac{-(y-\mu_1)^2}{2\sigma_1^2} \right)} \\[10pt] & \sim \frac{-(y - \mu_1)^2}{2\sigma_1^2} + \frac{(y - \mu_2)^2}{2\sigma_2^2} \\[10pt] & \sim \sigma_1^2 (y - \mu_2)^2 - \sigma_2^2 (y - \mu_1)^2 \\[10pt] & = (\sigma_1^2 - \sigma_2^2) \Big( y^2 - 2(\sigma_1^2\mu_2 - \sigma_2^2\mu_1)y + \cdots\cdots \Big) \\ & \qquad \text{(Here and below, “$\cdots\cdots$'' means something not depending on $y$.)} \\[10pt] & \sim \left( y - \frac{\sigma_1^2\mu_2 - \sigma_2^2\mu_1}{\sigma_1^2 - \sigma_2^2} \right)^2 \tag 1 \end{align} This one rejects the null hypothesis if the test statistic $(1)$ is two small. How small is too small depends on the level of the test and on the probability distribution of $(1).$ Under the null hypothesis, the test statistic $(1)$ has a non-central chi-square distribution with $1$ degree of freedom. ($(y-\mu_1)$ has a central chi-square distribution; the test statistic's distribution is non-central because the quantity subtracted from $y$ is not the expected value.)

If one observes an i.i.d. sample $Y_1,\ldots,Y_n,$ then the same argument can be made with $(y_1+\cdots+y_n)/n$ in place of $y$ and $\sigma_i^2/n$ in place of $\sigma_i^2.$

• Thanks a lot for your help! One follow-up question: How could we tell what the rejection region should be for this type of a test? Jul 3, 2017 at 18:04
• @user459815 : If $i=1$ is the null hypothesis and you're testing at the level (for example) $0.05,$ then you'd need to find the value of $c$ for which $\Pr( L(1)/L(2) < c) = 0.05,$ and reject $H_0$ if $L(1)/L(2)<c.$ Some algebra and working with the Gaussian c.d.f. should tell you whether that's a routine problem or not. (I'm not sure yet how involved that will be.) $\qquad$ Jul 3, 2017 at 18:13
• There was a typo in the answer; I've fixed it now. In front of $\exp,$ you need $\dfrac 1 {\sigma_i},$ not $\dfrac 1 {\sigma_i^2}. \qquad$ Jul 3, 2017 at 18:14
• ok, I'll post some more details shortly$\,\ldots\qquad$ Jul 5, 2017 at 20:40