Learn R Programming

FSA (version 0.8.6)

binCI: Confidence intervals for binomial probability of success.

Description

Uses one of three methods to compute a confidence interval for the probability of success (p) in a binomial distribution.

Usage

binCI(x, n, conf.level = 0.95, type = c("wilson", "exact", "asymptotic",
  "all"))

Arguments

x
A single or vector of numbers that contains the number of observed successes.
n
A single or vector of numbers that contains the sample size.
conf.level
A single number that indicates the level of confidence (default is 0.95).
type
A string that identifies the type of method to use for the calculations. See details.

Value

  • A #x2 matrix that contains the lower and upper confidence interval bounds as columns.

Details

This function will compute confidence interval for three possible methods chosen with the type argument. ll{ type="wilson" Wilson's (Journal of the American Statistical Association, 1927) confidence interval for a proportion. This is the score CI, based on inverting the asymptotic normal test using the null standard error. type="exact" Computes the Clopper/Pearson exact CI for a binomial success probability. type="asymptotic" This uses the normal distribution approximation. } Note that Agresti and Coull (2000) suggest that the Wilson interval is the preferred method and is, thus, the default type.

References

Agresti, A. and B.A. Coull. 1998. Approximate is better than exact for interval estimation of binomial proportions. American Statistician, 52:119-126.

See Also

See binom.test, binconf in Hmisc, binom.conf.int in epitools, and functions in binom.

Examples

Run this code
binCI(7,20,type="wilson")
binCI(7,20,type="exact")
binCI(7,20,type="asymptotic")

## Demonstrates using all types at once
binCI(7,20,type="all")

## Demonstrates use with multiple inputs
binCI(c(7,10),c(20,30))

Run the code above in your browser using DataLab