According to http://www.itl.nist.gov/div898/handbook/prc/section2/prc241.htm Agresti-Coull intervals cannot be negative; however using the formula from Wikipedia as well as the binom.confint function in R with x = 0 and n = 5 produces an interval of (-0.05457239, 0.4890549).

Are there conflicting definitions of Agresti-Coull?

Edit -

Using binom.confint:

binom.confint(0, 5, .95, 'agresti-coull')
         method x n mean       lower     upper
1 agresti-coull 0 5    0 -0.05457239 0.4890549

Manually calculating the lower bound (using the formula from Wikipedia):

> n <- 5
> x <- 0
> n2 <- n+qnorm(0.025)^2
> p <- 1/n2 * (0 + .5 * zn^2) 
> zn <- qnorm(0.025)
1/n2 * (0 + .5 * zn^2) + zn * sqrt(1/n2 * p * (1 - p))
[1] -0.05457239
  • $\begingroup$ I haven't done any computing (not able to, right now) but looking at the formula for LL, how could it be negative? The numerator is all positive things, isn't it? Or am I missing something? $\endgroup$ – Peter Flom May 22 '13 at 16:37
  • 6
    $\begingroup$ Although the Wikipedia article and the NIST page both reference the same paper, and give this confidence interval the same name, they use different formulas. The NIST is correct that its formula will not produce negative values, but the Wikipedia formula can be negative. The NIST interval is attributed by Agresti & Coull to Wilson (1927); they call it the "score" interval. They proceed to develop an approximation for the score interval: the Wikipedia formula appears to be this approximation. $\endgroup$ – whuber May 22 '13 at 16:43
  • 3
    $\begingroup$ +1. The Agresti-Coull interval is symmetric about the point estimate and thus will certainly yield negative lower limit when you have 0 successes. It is not guaranteed identical to the Wilson interval. $\endgroup$ – Nick Cox May 22 '13 at 16:53
  • 3
    $\begingroup$ It seems worth remarking that Agresti & Coull ended up recommending a rather simple approximation: add two to $x$ and four to $n$ to estimate $p$ and then compute the (simple) Wald interval $\hat{p}\pm z_{1-\alpha/2}\sqrt{\hat{p}(1-\hat{p})/n}$. This "confidence interval behaves adequately for practical application for essentially any $n$ regardless of the value of $p$" [p. 124]. Bear in mind, though, that this approximation assumes $\alpha\approx 0.05$; for extreme values of $\alpha$, the Wilson (score) interval is preferable. $\endgroup$ – whuber May 22 '13 at 19:02

The lower limit of the formula from your link cannot be negative. But the interval from your link is not the Agresti-Coull interval, it is the Wilson interval. The formulas from your link are for the so called Wilson interval and not the Agresti-Coull interval. Agresti and Coull list the formulas from your link in their paper and call it the score confidence interval (page 120). In the superb paper from Brown et al. (2001) Interval estimation for a binomial proportion, it is called the Wilson interval. It is more commonly know as Wilson interval. They show in their article that the Wilson interval performs well even with small n. In the output of binom.confint the Wilson interval is denoted as wilson and can be calculated by setting the method methods="wilson" in binom.confint. Here is the R code for the (modified) Wilson confidence interval:

n <- 5
x <- 0

alpha <- 0.05

p.hat <- x/n

upper.lim <- (p.hat + (qnorm(1-(alpha/2))^2/(2*n)) + qnorm(1-(alpha/2)) * sqrt(((p.hat*(1-p.hat))/n) + (qnorm(1-(alpha/2))^2/(4*n^2))))/(1 + (qnorm(1-(alpha/2))^2/(n)))

lower.lim <- (p.hat + (qnorm(alpha/2)^2/(2*n)) + qnorm(alpha/2) * sqrt(((p.hat*(1-p.hat))/n) + (qnorm(alpha/2)^2/(4*n^2))))/(1 + (qnorm(alpha/2)^2/(n)))

# Modification for probabilities close to boundaries

if ((n <= 50 & x %in% c(1, 2)) | (n >= 51 & n <= 100 & x %in% c(1:3))) {
  lower.lim <- 0.5 * qchisq(alpha, 2 * x)/n

if ((n <= 50 & x %in% c(n - 1, n - 2)) | (n >= 51 & n <= 100 & x %in% c(n - (1:3)))) {
  upper.lim <- 1 - 0.5 * qchisq(alpha, 2 * (n - x))/n

[1] 0.4344825

[1] 3.139253e-17

Here, the lower limit is clearly 0 (the remaining is a numerical error). The Wilson interval in the output of binom.confint can be calculated by setting the option methods="wilson" and this is the same as the one we've calculated above:


binom.confint(x=0, n=5, methods="wilson")

  method x n mean        lower     upper
1 wilson 0 5    0 3.139253e-17 0.4344825

The function binom.confint implements the formulas given on the Wikipedia page for the Agresti-Coull interval:

n.hat <- n + qnorm(1-(alpha/2))^2

p.hat <- (1/n.hat) * (x + (1/2)*qnorm(1-(alpha/2))^2)

upper.lim2 <- p.hat + qnorm(1-(alpha/2))*sqrt((1/n.hat)*p.hat*(1-p.hat))

lower.lim2 <- p.hat - qnorm(1-(alpha/2))*sqrt((1/n.hat)*p.hat*(1-p.hat))

[1] 0.4890549

[1] -0.05457239

They are the same as the ones by binom.confint with the option methods="ac":


binom.confint(x=0, n=5, methods="ac")

         method x n mean       lower     upper
1 agresti-coull 0 5    0 -0.05457239 0.4890549
| cite | improve this answer | |
  • $\begingroup$ When I tried binom.confint(0, 5, .95) I got a negative LL. Something is wrong. $\endgroup$ – Peter Flom May 22 '13 at 16:51
  • 1
    $\begingroup$ @PeterFlom binom.confint doesn't use the formulas that the OP linked. The function uses those the formulas given on the Wiki page an those clearly can be negative. So there's nothing wrong with the function, it just uses a different formula. $\endgroup$ – COOLSerdash May 22 '13 at 16:53
  • $\begingroup$ thanks, seems silly to compute such approximations this day in age... $\endgroup$ – user4733 May 22 '13 at 16:58
  • 5
    $\begingroup$ Not so; it's a surprisingly difficult problem and smart people have proposed different solutions from different views of what is most important. Computation is a secondary issue. No one obliges users to ask for two-sided confidence intervals here. All the methods proposed try to use defensible logic for different intervals. See Brown, L. D., T. T. Cai, and A. DasGupta. 2001. Interval estimation for a binomial proportion. Statistical Science 16: 101–133 for a superb review. $\endgroup$ – Nick Cox May 22 '13 at 17:12
  • $\begingroup$ I'm okay with there being multiple solutions to binomial confidence intervals, but choosing between an approximation to the Agresti-Coull interval estimator and the actual Agresti-Coull interval estimator shouldn't be that controversial. I can understand using the approximation when working with analytical expressions, but for a function that computes the interval on data, why would anyone ever bother with the approximation? $\endgroup$ – user4733 May 22 '13 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.