# Likelihood Ratio Test for Poisson Distribution

Suppose we have the following count data:

|   X   | Freq |
|-------|------|
|   0   |  18  |
|   1   |  32  |
|   2   |  17  |
|   3   |  10  |
|   4   |   5  |
|   5   |   2  |
| TOTAL |  84  |


We want to construct a likelihood ratio test to see if a Poisson distribution is suitable to describe the data. The likelihood and log-likelihood equations for a Poisson distribution are:

$$L(\lambda) = \prod_{y=1}^{84} \frac{e^{-\lambda}\lambda^y}{y!}$$

$$l(\lambda) = \sum_{y=1}^{84}\bigg(-\lambda + ylog(\lambda) - log(y!) \bigg)$$

We can solve for the MLE $\hat{\lambda}$ as follows:

$$\frac{dl(\lambda)}{d\lambda} = \sum_{y=1}^{84}\bigg(-1 + \frac{y}{\lambda}\bigg) = 0 \rightarrow \hat{\lambda} = \frac{\sum_{y=1}^{84}y}{84} = \frac{\sum_{i=1}^{84}x_i f_i}{84} = \frac{126}{84} = 1.5$$

The alternative hypothesis is that the data follow a multinomial distribution. The likelihood and log-likelihood equations for a Poisson distribution are:

$$L(p_0,p_1,p_2,p_3,p_4,p_5) = {n\choose{f_0,f_1,f_2,f_3,f_4,f_5}} p_0^{f_0} p_1^{f_1} p_2^{f_2} \pi_3^{f_3} p_4^{f_4} p_5^{f_5}$$

$$l(p_0,p_1,p_2,p_3,p_4,p_5) = log{n\choose{f_0,f_1,f_2,f_3,f_4,f_5}} + \sum_{i=0}^{5} f_i \times log(p_i)$$

Using the method of Lagrange Multipliers (with constraint $\sum_{i=0}^{5} p_i = 1$), it can be shown that the MLE's $\hat{p_i}$ are equal to:

$$\hat{p_i} = \frac{f_i}{n}$$

I know that the likelihood ratio statistic is defined as $D = -2(l_0 - l_A) \sim \chi_{(6-1)-1}^2 \sim \chi_4^2$, where $l_A = l(p_0,p_1,p_2,p_3,p_4,p_5)$, i.e. the log-likelihood equation for the multinomial distribution.

However, I am not sure what $l_0$ should be. Do I assume that the distribution of the null hypothesis follows a multinomial distribution with $p_i$ ~ Poisson (Case 1), or do I assume that the null hypothesis follows Poisson distribution (Case 2)? I've tried both and I do not get the same answer.

Case 1: $l_0 = log{n\choose{f_0,f_1,f_2,f_3,f_4,f_5}} + \sum_{i=0}^{5} f_i \times log\bigg(\frac{e^{-\hat{\lambda}}\hat{\lambda}^i}{i!}\bigg)$

Case 2: $l_0 = \sum_{y=1}^{84}\bigg(-\lambda + ylog(\lambda) - log(y!) \bigg)$

You seem to be using the generalised likelihood ratio test. However, this only works when the alternative hypothesis is a more general version of the null hypothesis, for example when the null hypothesis is that $\lambda = 1$ and the alternative hypothesis is that $\lambda$ is unconstrained (can be anything but 1). Since you're testing Poisson against multinomial, the generalised LRT doesn't really work.
You can still use a chi-squared test to conduct a chi-squared test of goodness of fit, but replace the alternative hypothesis with 'The data do not follow the Poisson distribution'. Here, the chi-squared test statistic $\chi^2 = \sum_{i}\frac{O_i- E_i}{E_i}$ roughly follows the $\chi^2_{6-1-1}$ distribution for large $n$ (where $O_i$ and $E_i$ refer to the observed and expected values of the frequency in the i-th bin).*