Likelihood Ratio Test for Binomial Random Variable

binomial distributionmaximum likelihoodprobabilitystatistical-inferencestatistics

For a binomial distributed random variable, I have $ n = 1225, x = 25$

Maximum likelihood parameter $p = 2.0408 \% $

I need to test it against the hypothesis $p_0 \ge 4.08\%$

Can I define likelihood of null and alternate hypothesis as following ?:

$$
\begin{split}
L(p_0) &= \int_{4.08\%}^1 C(1225,25) \times p^{25} \times (1-p)^{1220} dp \\
L(p_\alpha ) &= C(1225,25) \times 4.08\%^{25} \times (1-4.08\%)^{1220} \\
-2 \ln\left(\frac{L(p_0)}{L(p_\alpha)}\right) &\sim \chi^2(1)
\end{split}
$$

But I have a doubt if it is permissible to test a range of values vs a single value.

Best Answer

You can verify that The LR test will reject the null hypothesis $H_0: p \ge 0.0408$ in favor of the alternative $H_a: p < 0.0408$ for sufficiently small values of $\hat p = x/n,$ which is to say small values of $x.$

Then for $n = 1225, \hat p=0.020408,$ the P-value of your LR test will be $P(X \le 25\, |\, n=1225, p=0.0408) \approx 0.$ This P-value is much smaller than $0.05 = 5\%,$ so you reject $H_0$ in favor of $H_a.$

enter image description here

R code for figure:

n = 1225; p=0.0408; x = 0:90; PDF = dbinom(x,n,p)
hdr = "PDF of BINOM(1225, 0.0408)"
plot(x, PDF, type="h", col="blue", lwd=2, main=hdr)
 abline(h=0, col="green2") 
 abline(v=0, col="green2")
 abline(v = 25.5, col="red", lwd=2, lty="dotted")

Because $n$ is so large, you could approximate this P-value with a normal approximation. The exact binomial probability can be found from R as shown below:

pbinom(25, 1225, 0.0408)
[1] 5.508296e-05

Note: Testing with a discrete probability distribution such as binomial, it not not usually possible to do a (nonrandomized) test at exactly the 5% level.

But if you used $c = 38$ as the 'critical value' for the test (that is, rejecting $H_0$ for $X\le c),$ you would have significance level $\alpha=4.43\%,$

qbinom(.05, 1225, .0408)
[1] 39
pbinom(39, 1225, .0408)
[1] 0.06102795
pbinom(38, 1225, .0408)
[1] 0.04434609

If you use a normal approximation to approximate the critical value, it may seem that you are testing at level 5%, but there are no possible (integer) values of $x$ that give z-scores very near to -1.645.

qnorm(.05)
[1] -1.644854
Related Question