Learn R Programming

pgirmess (version 1.2.8)

CI: Confidence interval of percentages

Description

Provides a n x 2 matrix with the lower limit (column 1) and upper limit (column 2) of the 95 percent confidence interval of percentages

Usage

CI(x, y, totrials = FALSE)

Arguments

x
a vector with the number of positive observations
y
a vector of the same length as x with the number of negative observations, or of the total number of observations
totrials
if false (the default) y is the number of negative observations; if true, y is the total number of observations

Value

  • A matrix of length(x) rows and 2 columns. Column 1: lower limit; column 2: upper limit of the 95 percent confidence interval

Details

Wrapper of prop.test().

See Also

prop.test

Examples

Run this code
x<-c(2,10,7,8,7) # eg: number of positive cases
y<-c(56,22,7,20,5)# eg: number of negative cases
CI(x,y)

x<-c(2,10,7,8,7) # eg: number of positive cases
y<-c(4,11,7,16,10)# eg: total number of cases
CI(x,y,totrials=TRUE)

Run the code above in your browser using DataLab