Learn R Programming

epitools (version 0.5-2)

binom.conf.int: Confidence intervals for binomial counts or proportions

Description

Calculates confidence intervals for binomial counts or proportions

Usage

binom.exact(x, n, conf.level = 0.95)
binom.wilson(x, n, conf.level = 0.95)
binom.approx(x, n, conf.level = 0.95)

Arguments

x
number of successes in n trials, can be a vector
n
number of Bernoulli trials, can be a vector
conf.level
confidence level (default = 0.95), can be a vector

Value

  • This function returns a n x 6 matrix with the following colnames:
  • xnumber of successes in n trials
  • nnumber of Bernoulli trials
  • propproportion = x/n
  • lowerlower confidence interval limit
  • upperupper confidence interval limit
  • conf.levelconfidence level

Details

The function, binom.exact, calculates exact confidence intervals for binomial counts or proportions. This function uses R's binom.test function; however, the arguments to this function can be numeric vectors of any length. The function, binom.wilson, calculates confidence intervals for binomial counts or proportions using Wilson's formula which approximate the exact method. The arguments to this function can be numeric vectors of any length (Rothman). The function, binom.approx, calculates confidence intervals for binomial counts or proportions using a normal approximation to the binomial distribution. The arguments to this function can be numeric vectors of any length.

References

Tomas Aragon, et al. Applied Epidemiology Using R. Available at http://www.epitools.net Kenneth Rothman (2002), Epidemiology: An Introduction, Oxford University Press, 1st Edition.

See Also

pois.exact, binom.test

Examples

Run this code
binom.exact(1:10, seq(10, 100, 10))
binom.wilson(1:10, seq(10, 100, 10))
binom.approx(1:10, seq(10, 100, 10))

Run the code above in your browser using DataLab