binomCI: Binomial Confidence Interval

Description Usage Arguments Value References Examples

View source: R/binomCI.R

Description

Calculates the binomial confidence interval from a sample, using the normal approximation. Uses Louis (1981) if only failures or only successes were observed.

Usage

1
binomCI(x, y = NULL, na.rm = TRUE, alpha = 0.05, prob = TRUE)

Arguments

x

A vector of 0s and 1s, or (if y is also given) a scalar, the number of successes.

y

A scalar, the number of failures, default NULL.

na.rm

A logical, whether to remove NAs from the data, default TRUE.

alpha

A scalar, the desired confidence level, default 0.05.

prob

A logical, whether to output results as probabilities, default TRUE, or counts.

Value

A named vector with the Mean, lower and upper confidence limits (L and U), and the number of observations N.

References

Thomas A. Louis. 1981. Confidence intervals for a binomial parameter after observing no successes. The American Statistician 35(3):154. http://amstat.tandfonline.com/doi/abs/10.1080/00031305.1981.10479337?journalCode=utas20#.U3t2EvldX64

Examples

1
2
binomCI(c(0, 0, 0, 0, 1, 1))
binomCI(2, 4, prob=FALSE)

JVAdams/jvamisc documentation built on Aug. 11, 2021, 6:43 a.m.