Learn R Programming

abd (version 0.1-21)

wilsonCI: Wilson (Agresti-Coull) CI for a Binomial Proportion

Description

Calculate the confidence interval for a "small sample" binomial proportion using the Agresti-Coull (1998) method. Useful for small samples where the Wald "large sample" normal test used by binom.test is not appropriate (when n is small or when p is close to 0 or 1).

Usage

wilsonCI(x, n, conf.level = 0.95)

Arguments

x
an integer number of successes
n
an integer number of trials
conf.level
the confidence level for interval estimation; defaults to 0.95

Value

  • Returns an object of type prop.ci, which includes:
  • xthe number of successes
  • nthe number of trials
  • conf.levelthe confidence interval level
  • lowerthe lower bound of the confidence interval
  • upperthe upper bound of the confidence interval
  • intervalthe interval
  • estimatethe estimated proportion ($(x+2)/(n+4))$

References

Agresti, A. and B.A. Coull. 1998. Approximate is better than "exact" for interval estimation of binomial proportions. The American Statistician 52: 119-126. http://www.jstor.org/stable/2685469

See Also

binom.test

Examples

Run this code
propCI(7, 50)
propCI(7, 50, conf.level = 0.99)
# should be very close to the score interval of prop.test
prop.test(7,50)

Run the code above in your browser using DataLab