bin.ci {NCStats}R Documentation

Confidence intervals for binomial probability of success.

Description

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

Usage

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

Arguments

x A number representing the number of observed successes.
n A number representing the sample size.
conf.level A number indicating the level of confidence to use for constructing confidence intervals (default is 0.95).
type A string that identifies the type of method to use for the calculations. See details.

Details

This function will compute confidence interval for three possible methods chosen with the type argument.

type="wilson"
Wilson's confidence interval for a proportion (Journal of the American Statistical Association, 1927). 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.
type="AC2"
Agresti-Coull add-4 CI for a binomial proportion, based on adding 2 successes and 2 failures before computing the Wald CI (American Statistician, 1998; see also article by Agresti and Caffo in American Statistician, 2000). The CI is truncated when it overshoots the boundary.

Note that Agresti and Coull (2000) suggest that the Wilson interval is the preferred method.

Value

A 1x2 matrix containing the lower and upper confidence interval bounds.

Author(s)

Derek H. Ogle, dogle@northland.edu. However, this is primarily a wrapper function for binconf in the Hmisc package (this implementation uses arguments, specificially conf.level, that more closely match other functions).

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

binconf in Hmisc, bin.conf.int in epitools, and binom.conf.interval in UCS.

Examples

  bin.ci(7,20,type="wilson")
  bin.ci(7,20,type="exact")
  bin.ci(7,20,type="all")

[Package NCStats version 0.0-12 Index]