Solved – How to get the confidence interval of a Bernoulli trial if $\hat{p} = 0$

bernoulli-distributionconfidence intervalsmall-sample

I know the standard formula for the Bernoulli CI is:

$$\hat{p}\pm z_{1-\alpha/2}\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}$$

If $\hat{p} = \frac{m}{n}$ how do I estimate the confidence interval when$\ n$ is small and$\ m = 0$? This case would collapse the above equation to $\ 0 \pm 0$, which implies that the confidence interval does not improve with larger $\ n$.

In my mind, the CI should start at [0,1] and the upper bound should decrease as $\ n$ increases, given that $\ m$ remains at 0.

Best Answer

The reason the usual "CLT" confidence interval becomes 0 is because when $p$ is very close to 0 or 1 (and the relative number of samples is low), the CLT becomes a bad approximation. This is because when $p=0,1$, your random variable is constant. On the other hand, when $p$ is very close to 1 or 0, you need a very large amount of samples to distinguish $p$ from exactly 1 or 0.

There are a couple of approaches to get the true confidence interval. The easy way is to appeal to the Wilson score interval:

$$\frac{1}{1 + \frac{1}{n} z^2} \left[ \hat{p} + \frac{1}{2n} z^2 \pm z \sqrt{ \frac{1}{n}\hat{p} \left(1 - \hat{p}\right) + \frac{1}{4n^2}z^2 } \right].$$

The second option is to numerically estimate the true confidence interval by explicitly using the binomial distribution, as opposed to appealing to the normal distribution.

Related Question