Produces 1-alpha confidence intervals for binomial probabilities.
binconf(x, n, alpha=0.05, method=c("wilson","exact","asymptotic","all"), include.x=FALSE, include.n=FALSE, return.df=FALSE)
Arguments
x: vector containing the number of "successes" for binomial variates
n: vector containing the numbers of corresponding observations
alpha: probability of a type I error, so confidence coefficient = 1-alpha
method: character string specifing which method to use. The "all" method only works when x and n are length 1. The "exact" method uses the F distribution to compute exact (based on the binomial cdf) intervals; the "wilson" interval is score-test-based; and the "asymptotic" is the text-book, asymptotic normal interval. Following Agresti and Coull, the Wilson interval is to be preferred and so is the default.
include.x: logical flag to indicate whether x should be included in the returned matrix or data frame
include.n: logical flag to indicate whether n should be included in the returned matrix or data frame
return.df: logical flag to indicate that a data frame rather than a matrix be returned
Returns
a matrix or data.frame containing the computed intervals and, optionally, x and n.