# Likelihood Ratio Test for binomial proportions

Suppose we wish to preform a simple likelihood ratio test for the parameters of two binomial distributions. Where the null hypothesis is that the two parameters are equal versus the alternative they are not.

Now for the following example, to construct a normal test or T-test would be straightforward. However I am interested in comparing this to using the likelihood ratio test and chi-square distribution.

Say we know for example

$$A∼Bin(40,p_{A})$$

and

$$B∼Bin(20,p_{B})$$

and we observe data from A and we observe $$24$$ successes hence we can then estimate $$p=0.6$$

and from B we observe data and observe $$15$$ successes hence $$p=0.75$$

How would one go about forming the likelihood test statistic?

Let $$n_A=24$$, $$n_B=15$$, and $$n=n_A+n_B$$. Likewise the number of trials, Let $$N_A=40$$, $$N_B=20$$, and $$N=N_A+N_B$$.

The null hypothesis, $$H_0$$ is that there is one success probability, $$p$$, and the alternative, $$H_1$$, is that there are two, $$p_A$$ and $$p_B$$.

The maximum likelihood estimate under $$H_0$$ is $$\hat{p}=n/N$$. The maximum likelihood estimates under $$H_1$$ are $$\hat{p}_A=n_A/N_A$$ and $$\hat{p}_B=n_B/N_B$$.

The likelihood ratio test would use the statistic, $$\lambda=\frac{{\cal{L}}(n_A|N_A,\hat{p})\,{\cal{L}}(n_B|N_B,\hat{p})}{{\cal{L}}(n_A,n_B|N_A,N_B,\hat{p}_A,\hat{p}_B)}=\frac{{\cal{L}}(n_A|N_A,\hat{p})\,{\cal{L}}(n_B|N_B,\hat{p})}{{\cal{L}}(n_A|N_A,\hat{p}_A)\,{\cal{L}}(n_B|N_B,\hat{p}_B)}$$

Where the likelihoods are calculated according to the binomial probability mass function. The quantity, $$z = -2\ln\lambda$$ will tend to follow the $$\chi^2$$ distribution with number of degrees of freedom equal to the difference in the number of parameters for the two models. Look up Wilkes theorem for more information.

In this case, the $$Z$$ distribution is similar to the $$\chi^2$$ distribution for 1 degree of freedom, but not exactly. There are only a finite number of combinations for $$n_A$$ and $$n_B$$, so there are a finite number of values that $$z$$ can take on. The plot below shows the distribution of 1 million $$z$$ values with the scaled $$\chi^2$$ pdf overlayed. This was evaluated with $$N_A=40$$, $$N_B=20$$, and $$p = 39/60$$.

The particular observation you observe ($$n_A=24$$, $$n_B=15$$) has $$z_{obs}=1.359$$. For a $$\chi^2$$ distribution that corresponds to a p-value of 0.244. Of the million $$z$$ values, 24% have $$z>z_{obs}$$ and 1.3% have $$z=z_{obs}$$, so using the $$\chi^2$$ distribution is a reasonable approximation to calculate the p-value.

Making the plot with finer bins shows the issue with the finite number of outcomes more clearly:

• Where do you get that pvalue using chi squared? I dont get the same – Learning Oct 26 '18 at 6:00
• Seems that I made a typo - I have corrected in the post. – Dean Oct 26 '18 at 18:43