Confidence Intervals for Proportions

Description

Alternatives to codeprop.test() and binom.test().

Usage

1
2
wilson.ci(x, n = 100, conf.level = 0.95)
wald.ci(x, n = 100, conf.level = 0.95) 

Arguments

x

number of 'successes'

n

number of trials

conf.level

confidence level

Details

wald.ci() produces Wald confidence intervals. wilson.ci() produces Wilson confidence intervals (also called “plus-4” confidence intervals) which are Wald intervals computed from data formed by adding 2 successes and 2 failures. The Wilson confidence intervals have better coverage rates for small samples.

Value

Lower and upper bounds of a two-sided confidence interval.

Author(s)

Randall Pruim

References

A. Agresti and B. A. Coull, Approximate is better then ‘exact’ for interval estimation of binomial proportions, American Statistician 52 (1998), 119–126.

Examples

1
2
3
4
5
prop.test(12,30)
prop.test(12,30, correct=FALSE)
wald.ci(12,30)
wilson.ci(12,30)
wald.ci(12+2,30+4)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.