Wilson confidence interval of a proportion
Details
The Wilson interval behaves well for small samples and proportions close to 0 or 1, where the usual normal interval goes below 0 or above 1. With \(\hat p = x/n\) and \(z\) the normal quantile, $$\frac{\hat p + \frac{z^2}{2n} \pm z\sqrt{\frac{\hat p(1-\hat p)}{n} + \frac{z^2}{4n^2}}}{1 + \frac{z^2}{n}}.$$
References
Wilson, E. B. (1927). Probable inference, the law of succession, and statistical inference. Journal of the American Statistical Association, 22(158), 209-212.