Solved – Hypothesis test on variance of normal sample

likelihood-ratio

This question is a follow-up to this discussion:
https://math.stackexchange.com/questions/634914/distribution-of-likelihood-ratio-in-a-test-on-the-unknown-variance-of-a-normal-s/635371?noredirect=1#comment1339933_635371

Could someone audit the reasoning below?

I am trying to derive the distribution of the likelihood ratio statistic for the hypothesis test below.

Let $X_1 … X_{n}$ be a random sample from a $N(\mu,\sigma^2)$ distribution, where $\mu$ is known and $\sigma^2$ is unknown. I want to test the hypothesis $H_0 : \sigma^2 = \sigma_{0}^{2} $ vs. $H_1 : \sigma^2 \neq \sigma_{0}^{2}$ (and, trivially, $\sigma^2 >0$).

The generic joint pdf for the n independent random variables (ie. the likelihood function for the random sample) is:

$L=\prod_{i=1}^{n} \large\left(\frac{1}{\sqrt{2\pi\sigma^2}}\right)\cdot e^{-\frac{(X_i – \mu)^2}{2\sigma^2}}= \large\left(\frac{1}{\sqrt{2\pi\sigma^2}}\right)^{n}\cdot e^{-\frac{\sum_{i=1}^{n} (X_i – \mu)^2}{2\sigma^2}}$

Under the null hypothesis, the maximum value taken by $L$ is: $\large\left(\frac{1}{\sqrt{2\pi\sigma_{0}^{2}}}\right)^{n}\cdot e^{-\frac{\sum_{i=1}^{n} (X_i – \mu)^2}{2\sigma_{0}^{2}}}$

If we do not constrain $\sigma^{2}$ to be equal to $\sigma_{0}^{2}$, then $L$ is maximised by the maximum likelihood estimator $\hat{\sigma}^{2}=\frac{\sum_{i=1}^{n} (X_i – \mu)^2}{n}$

In this case, the maximum likelihood becomes:
$\large\left(\frac{1}{\sqrt{2\pi\hat{\sigma_{0}}^{2}}}\right)^{n}\cdot e^{-\frac{\sum_{i=1}^{n} (X_i – \mu)^2}{2\hat{\sigma_{0}}^{2}}}$

Setting these as numerator and denominator, respectively, I get the following likelihood ratio statistic

$\Lambda = \LARGE\frac{\large\left(\frac{1}{\sqrt{2\pi\sigma_{0}^{2}}}\right)^{n}\cdot e^{-\frac{\sum_{i=1}^{n} (X_i – \mu)^2}{2\sigma_{0}^{2}}}}{\large(\frac{1}{\sqrt{2\pi\hat{\sigma_{0}}^{2}}})^{n}\cdot e^{-\frac{\sum_{i=1}^{n} (X_i – \mu)^2}{2\hat{\sigma_{0}}^{2}}}}
\\ = \frac{ \left(\frac{1}{\sqrt{2\pi\sigma_0^2}}\right)^{n/2}\cdot e^{-\frac{\sum_{i=1}^n (X_i – \mu)^2}{2\sigma_0^2}}} {\left(\frac{1}{\sqrt{2\pi\hat{\sigma}^{2}}}\right)^{n}\cdot e^{-(n/2)}} = \left(\frac {\hat{\sigma}^2}{\sigma_0^2}\right)^{n/2} \cdot \exp\left \{-\frac 12\left(\frac{\sum_{i=1}^n (X_i – \mu)^2}{\sigma_0^2}-n\right)\right\}$

Using the expression for $\hat \sigma^2$ we get

$$\Lambda = \left(\frac {\hat{\sigma}^2}{\sigma_0^2}\right)^{n/2} \cdot \exp\left \{-\frac n2\left(\frac {\hat{\sigma}^2}{\sigma_0^2}-1\right)\right\}$$

Now, under the null, the random variable denoted

$$z_i^2 = \left(\frac {x_i – \mu}{\sigma_0}\right)^2 \sim \chi^2(1)$$

We have

$$ \frac {\hat{\sigma}^2}{\sigma_0^2} = \frac 1n\sum_{i=1}^{n} \left(\frac {x_i – \mu}{\sigma_0}\right)^2 = \frac 1n \sum_{i=1}^{n}z_i^2$$

So we can write
$$\Lambda = \left(\frac 1n \sum_{i=1}^{n}z_i^2 \right)^{n/2} \cdot \exp\left \{-\frac n2\left( \frac 1n \sum_{i=1}^{n}z_i^2-1\right)\right\}$$

Taking minus log we have

$$-\ln \Lambda = -\frac n2 \ln \left(\frac 1n \sum_{i=1}^{n}z_i^2 \right) +\frac n2\left( \frac 1n \sum_{i=1}^{n}z_i^2-1\right)$$

Manipulating the second term in the RHS,

$$= -\frac n2 \ln \left(\frac 1n \sum_{i=1}^{n}z_i^2 \right) + \sqrt {\frac 1 2} \left( \frac {\sum_{i=1}^{n}(z_i^2-1)}{\sqrt {2}}\right)$$
and multiplying throughout by $\sqrt {2}$ we obtain

$$-\sqrt {2} \ln \Lambda = -\frac{n}{\sqrt{2}} \ln \left(\frac 1n \sum_{i=1}^{n}z_i^2 \right) + \left( \frac {\sum_{i=1}^{n}(z_i^2-1)}{\sqrt {2}}\right)$$
$$= -\frac{1}{\sqrt{2}} \ln \left[\left(\frac 1n \sum_{i=1}^{n}z_i^2\right)^n \right] + \left( \frac {\sum_{i=1}^{n}(z_i^2-1)}{\sqrt {2}}\right)$$

The second term in the RHS is a standardized sum of i.i.d $\chi^2(1)$ random variables, and this quantity will converge to a $N(0,1)$.
Then (abusing notation a bit),

$$\operatorname{plim}\left(-\sqrt {2} \ln \Lambda\right) = \operatorname{plim}\left(-\frac{1}{\sqrt{2}} \right)\cdot \operatorname{plim}\left\{\ln\left[ \left(\frac 1n \sum_{i=1}^{n}z_i^2 \right)\right]^n \right\} + \operatorname{plim}\left( \frac {\sum_{i=1}^{n}(z_i^2-1)}{\sqrt {2}}\right) $$

$$= -\frac{1}{\sqrt{2}} \cdot \left\{\operatorname{plim}\ln\left[\left(1 \right)^n\right] \right\}+ N(0,1)=-\frac{1}{\sqrt{2}} \cdot\infty + N(0,1) = -\infty$$

At this point, I am completely stuck as I can find neither the test statistic nor its distribution. Could someone flag any mistakes I have made and possibly help me find the test statistic and its distribution?

Best Answer

the last line is wrong. it's not infinite; instead, it's zero. therefore it $ -\sqrt {\frac 2n} \ln \Lambda \rightarrow_d N(0,1)$ and all are done

Related Question