| Title: | Confidence Intervals for a Binomial Proportion |
|---|---|
| Description: | Twelve confidence intervals for one binomial proportion or a vector of binomial proportions are computed. The confidence intervals are: Jeffreys, Wald, Wald corrected, Wald, Blyth and Still, Agresti and Coull, Wilson, Score, Score corrected, Wald logit, Wald logit corrected, Arcsine and Exact binomial. References include, among others: Vollset, S. E. (1993). "Confidence intervals for a binomial proportion". Statistics in Medicine, 12(9): 809-824. <doi:10.1002/sim.4780120902>. |
| Authors: | Michail Tsagris [aut, cre] |
| Maintainer: | Michail Tsagris <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.3 |
| Built: | 2026-05-24 06:26:30 UTC |
| Source: | https://github.com/cran/binomCI |
Functions to compute 12 confidence intervals for a binomial proportion.
| Package: | binomCI | |
| Type: | Package | |
| Version: | 1.3 | |
| Date: | 2026-02-01 | |
| License: | GPL-2 |
Michail Tsagris [email protected].
I would like to express my acknowledgements to Marc Girondot for spotting an error in the "Wilson" method in two extreme cases, when and when . He also proposed a modification that exists in the package "Hmisc" and the relevant paper to cite is Agresti & Coull (1998).
Herman Callaert pointed out to me a limitation of the Agresti & Coull (1998) CI, and I fixed it. Their formula is valid only for confidence.
Michail Tsagris [email protected].
Agresti, A. & Caffo, B. (2000). Simple and effective confidence intervals for proportions and differences of proportions result from adding two successes and two failures. The American Statistician, 54(4), 280–288.
Agresti, A. & Coull, B. A. (1998). Approximate is better than "exact" for interval estimation of binomial proportions. The American Statistician, 52(2): 119–126.
Brown, L. D., Cai, T. T. & DasGupta, A. (2001). Interval estimation for a binomial proportion. Statistical Science, 16(2): 101-133.
Brown, L. D., Cai, T. T. & DasGupta, A. (2002). Confidence intervals for a binomial proportion and asymptotic expansions. The Annals of Statistics, 30(1): 160-201.
Cameron, E. (2011). On the estimation of confidence intervals for binomial population proportions in astronomy: the simplicity and superiority of the Bayesian approach. Publications of the Astronomical Society of Australia, 28(2): 128–139.
Newcombe, R. G. (1998). Two-sided confidence intervals for the single proportion: comparison of seven methods. Statistics in Medicine, 17(8): 857–872.
Pan, W. (2002). Approximate confidence intervals for one proportion and difference of two proportions. Computational statistics & Data Analysis, 40(1): 143-157.
Pires, A. M. & Amado, C. (2008). Interval estimators for a binomial proportion: Comparison of twenty methods. REVSTAT-Statistical Journal, 6(2): 165-197.
Ranucci, G. (2009). Binomial and ratio-of-Poisson-means frequentist confidence intervals applied to the error evaluation of cut efficiencies. arXiv preprint arXiv:0901.4845.
Sauro, J. & Lewis, J. R. (2005, September). Estimating completion rates from small samples using binomial confidence intervals: comparisons and recommendations. In Proceedings of the Human Factors and Ergonomics Society Annual Meeting (Vol. 49, No. 24, pp. 2100-2103). Sage CA: Los Angeles, CA: SAGE Publications.
Somerville, M. C. & Brown, R. S. (2013). Exact likelihood ratio and score confidence intervals for the binomial proportion. Pharmaceutical Statistics, 12(3): 120-128.
Thulin, Mans. The cost of using exact confidence intervals for a binomial proportion. (2014): 817-840. Electronic Journal of Statistics 8(1): 817-840.
Vollset, S. E. (1993). Confidence intervals for a binomial proportion. Statistics in Medicine, 12(9): 809-824.
Confidence Intervals for a Binomial Proportion.
binomCI(x, n, a = 0.05)binomCI(x, n, a = 0.05)
x |
The number of successes. |
n |
The number of trials. |
a |
The significance level to compute the |
The confidence intervals are:
Jeffreys:
where denotes the quantile of the Beta distribution with parameters and , .
Wald:
where and denotes the quantile of the standard normal distribution. If the interval becomes and if the interval becomes .
Wald corrected:
and if or the previous (Wald) adjustment applies.
Wald BS:
and if or the previous (Wald) adjustment applies.
Agresti and Coull:
where . Herman Callaert pointed out to me that in their 1998 the authors of this
interval stated that this method is valid for confidence intervals, but not for other confidence levels such as or .
Hence, this interval is of confidence always.
Wilson:
where and .
Score:
where .
Score corrected:
where , and , .
Wald-logit:
where and . If or the previous (Wald) adjustment applies.
Wald-logit corrected:
where , , and .
Arcsine:
If or the previous (Wald) adjustment applies.
Exact binomial:
where , , , and denotes the quantile of the F distribution with degrees of freedom and , .
A list including:
prop |
The proportion. |
ci |
A matrix with 12 rows containing the 12 different |
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
binomCI(45, 100)binomCI(45, 100)
Confidence Intervals for many Binomial Proportions.
binomCIs(x, n, a = 0.05)binomCIs(x, n, a = 0.05)
x |
A vector with the number of successes. |
n |
A vector with the number of trials. |
a |
The significance level to compute the |
A list with the the first element being the vector with the proportions and the rest 12 items
contain the confidence intervals.
Michail Tsagris.
R implementation and documentation: Michail Tsagris [email protected].
x <- sample(40, 10) n <- rep(40, 10) binomCIs(x, n)x <- sample(40, 10) n <- rep(40, 10) binomCIs(x, n)