Learn R Programming

fastR2 (version 1.2.4)

wilson.ci: Confidence Intervals for Proportions

Description

Alternatives to prop.test and binom.test.

Usage

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

Value

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

Arguments

x

number of 'successes'

n

number of trials

conf.level

confidence level

Author

Randall Pruim

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.

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

Run this code

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

Run the code above in your browser using DataLab