# Constructing likelihood ratio test

Let $y_1$ and $y_2$ be independent Poissons with means $\lambda_1$ and $\lambda_2$. Find the likelihood ratio statistic for the test $H_0: \lambda_1 = \lambda_2$. Specify the asymptotic null distribution, and describe the condition under which the asymptotics apply.

I have the answer. It's $2\sum_i y_i\log\left(\frac{y_i}{ \bar{y}}\right)$. The asymptotic distribution is chi-squared with $df = 1$, when $\lambda_1$ and $\lambda_2$ are large.

The problem is that I have trouble arriving at this answer. I start with the poisson pmf, find the likelihood for each and take the ratio. But I dont see where the $\bar{y}$ comes from? Can someone show me how to get this? I'd really appreciate the help.

Edit: OK, what I got after taking the ratio of the likelihoods (at mle's) was $2n [\lambda_2 - \bar{y} + \bar{y}log(\bar{y} / \lambda_2)]$

• 1. Unless I made an error, I think the answer you give appears to be wrong; I think it's missing a term that can't be dropped if you're using the asymptotic approximation. 2. Note that $y_1+y_2=2\bar{y}$. Commented Nov 15, 2016 at 8:49
• Please add the self-study tag, read its tag-wiki and modify your question to follow the guidelines on asking such questions. In particular, you'll need to clearly identify what you've done to solve the problem yourself, and indicate the specific help you need at the point you struck difficulty. Commented Nov 15, 2016 at 8:49
• To add the tag you'd need to remove one. I think "generalized-linear-model" or "maximum-likelihood" could go, but if you want to keep both, just leave it out. Commented Nov 15, 2016 at 9:46
• Thanks Glen- see my edits. Also, the answer I gave came from my book so I'm not sure...but I haven't matched it either. Commented Nov 15, 2016 at 11:33
• What happened to the factorial terms? Commented Nov 15, 2016 at 11:39

## 2 Answers

Now that this answer is old it is worth providing a full solution. Let's start by looking at the maximised log-likelihood for data $$Y_1,...,Y_n \sim \text{IID Pois}(\lambda)$$. The log-likelihood function for this case is given by:

$$\ell_\mathbf{y}(\lambda) = n \Big[ \bar{y} \ln (\lambda) - \lambda \Big] + \text{const} \quad \quad \quad \text{for } \lambda \geqslant 0.$$

The corresponding score function and information function are given respectively by:

\begin{aligned} s_\mathbf{y}(\lambda) &= n \Big[ \frac{\bar{y}}{\lambda} - 1 \Big], \\[6pt] I_\mathbf{y}(\lambda) &= \frac{n \bar{y}}{\lambda^2}. \\[6pt] \end{aligned}

Since the information is strictly positive, the log-likelihood is strictly concave, and so the MLE occurs at the unique critical point where $$s_\mathbf{y}(\hat{\lambda})=0$$, which gives $$\hat{\lambda} = \bar{y}$$. Thus, the maximised log-likelihood is:

$$\hat{\ell}_\mathbf{y} \equiv \max_{\lambda} \ell_\mathbf{y}(\lambda) = \ell_\mathbf{y}(\hat{\lambda}) = n \bar{y} [\ln (\bar{y}) - 1] - \sum_{i=1}^n \ln(y!).$$

This gives the general form of the maximised log-likelihood function. In the present problem we have two data points that are either IID (under the null hypothesis) or they are independent values that are not identically distributed (under the alternative hypothesis). The resulting maximised log-likelihood functions under the two models are as follows.

Null hypothesis: Under the null hypothesis $$H_0: \lambda_1 = \lambda_2$$ we have:

$$\hat{\ell}_0 = (y_1+y_2) \ln \Big( \frac{y_1+y_2}{2} \Big) - (y_1+y_2) - \ln(y_1!) - \ln(y_2!).$$

Alternative hypothesis: Under the alternative hypothesis $$H_A: \lambda_1 \neq \lambda_2$$ we have:

$$\hat{\ell}_A = y_1 \ln (y_1) + y_2 \ln (y_1) - (y_1+y_2) - \ln(y_1!) - \ln(y_2!).$$

Likelihood ratio statistic: The above forms for the maximised log-likelihood functions give the likelihood ratio statistic:

\begin{aligned} \Delta (y_1, y_2) &= 2(\hat{\ell}_A - \hat{\ell}_0) \\[6pt] &= 2 \Bigg[ y_1 \ln (y_1) + y_2 \ln (y_1) - (y_1+y_2) \ln \Big( \frac{y_1+y_2}{2} \Big) \Bigg] \\[6pt] &= 2 \sum_{i=1}^2 y_i [ \ln (y_1) - \ln (\bar{y}) ] \\[6pt] &= 2 \sum_{i=1}^2 y_i \ln \Big( \frac{y_i}{\bar{y}} \Big). \\[6pt] \end{aligned}

Leaving a little work at the end for you, I got the following. This is a bit loose, but it's intended as an outline -- I'm sure you can tidy it up. Anyway here goes:

$\Lambda = \frac{\mathcal{L}_0(y_1,y_2)}{\mathcal{L}_1(y_1,y_2)}$

$\mathcal{L}_1=\exp(-\lambda_1)\lambda_1^{y_1}/y_1!\cdot \exp(-\lambda_2)\lambda_2^{y_2}/y_2!$

$\mathcal{L}_0=exp(-2\lambda)\lambda^{y_1+y_2}/(y_1+y_2)!$

$\hat{\lambda}_1=y_1\,,\hat{\lambda}_2=y_2\,,\hat{\lambda}=(y_1+y_2)/2=\bar{y}$

$\log(\Lambda)=\ell_0(y_1,y_2)-\ell_1(y_1,y_2)$

$= -2\lambda +2\bar{y}\log(\lambda)-\log((y_1+y_2)!)\\ \qquad - [-\lambda_1+y_1\log(\lambda_1)-log(y_1!)-\lambda_2+y_2\log(\lambda_2)-log(y_2!)]$

at MLE

$\log(\Lambda)=-2\bar{y} +2\bar{y}\log(\bar{y})-\log((y_1+y_2)!) \\ \qquad - [-y_1+y_1\log(y_1)-log(y_1!)-y_2+y_2\log(y_2)-log(y_2!)]$

$=-2\bar{y} +2\bar{y}\log(\bar{y})-\log((y_1+y_2)!)\\ \qquad - [-y_1+y_1\log(y_1)-log(y_1!)-y_2+y_2\log(y_2)-log(y_2!)]$

etc

If you simplify further, that gets to the answer in the question plus an additional term I don't believe you can leave out.