# Likelihood ratio test for the Bernoulli parameter with one-sided hypothesis

I have a sample $$X_1, \dots, X_n \sim Bern(p)$$ and need to test $$H_0: p = p_0\\H_1: p < p_0$$ using the likelihood ratio test. I know how to do it for the two-sided alternative: we should calculate $$LR = 2 (\ln L(x, \hat{p}^{ML}) - \ln L(x, p_0))$$ where $$L(x, \cdot)$$ is a likelihood function and $$\hat{p}^{ML} = \bar{x}$$. And then use the fact that $$LR \underset{H_0}{\sim} \chi^2(1)$$ to test the hypothesis. But how should I incorporate the fact that the alternative now is $$p < p_0$$? Should the distribution of $$LR$$ change in this case?

Would be very grateful for any help!

• What you mention about the chi-square distribution is only an asymptotic distribution of the log-likelihood ratio. The LRT statistic is $\Lambda=\frac{\sup\limits_{p=p_0}L(p)}{\sup\limits_{p\le p_0}L(p)}$ where $L(p)$ is the likelihood function. You reject $H_0$ for small values of $\Lambda$. This leads to an exact test of the form $\sum X_i<c$ where $c$ can be found subject to a size restriction. – StubbornAtom Nov 22 '19 at 19:28
• @StubbornAtom Thank you a lot for your answer! I get it. – D F Nov 23 '19 at 6:40
• If you do get it, you might want to answer it yourself, so interested users of the site can find the answer. Then you can accept it (fair, since it is a correct answer) and so forth. – jbowman Nov 24 '19 at 20:39

Let us consider the example, suppose we are testing $$H_0: p = 0.5\\H_1: p<0.5$$ and suppose that $$\bar{x} = 0.4$$. $$L(X, p) = p^{\sum X_i}(1-p)^{n - \sum X_i}$$ maximizing it wrt $$p$$ subject to $$p \le 0.5$$ yileds $$\hat{p} = \bar{x} < 0.5$$ and hence $$\Lambda = \frac{0.4^{\sum X_i}0.6^{n - \sum X_i}}{0.5^n} \ge k \iff \sum X_i \ln 0.4 + (n - \sum X_i)\ln 0.6 \ge k_1 \iff \sum X_i \le C$$ And it remains to find such a $$C$$ that $$\mathbb{P}\left(\sum X_i \le C\right|p=0.5) = \alpha$$, which we can do using, for example the CLT $$\frac{\sum X_i - np}{\sqrt{p(1-p)}} \approx \mathcal{N}(0, 1) \to 2\sum X_i - n \underset{H_0}{\approx} \mathcal{N}(0, 1) \to \mathbb{P}\left(\sum X_i \le C\right) = \mathbb{P}\left(2 \sum X_i - n \le 2C - n\right) = 0.05 \to 2C - n = 1.64 \to C = \frac{n+1.64}{2}$$.
Thus, we reject the null if $$\sum X_i \le \frac{n+1.64}{2}$$