Calculate confidence intervals of proportion or difference between proportions
Source:R/propCI.R
propCI.Rd
Calculate confidence intervals of proportion or difference between proportions
Usage
propCI(
x,
y,
n,
p,
n1,
n2,
p1,
p2,
P = 0,
alpha = 0.05,
digits = 2,
alternative = "two.sided"
)
Arguments
- x
A vector
- y
A vector
- n, n1, n2
integer sample size
- p, p1, p2, P
Numeric proportion
- alpha
numeric confidence level
- digits
integer indicating the number of decimal places
- alternative
A character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".
Value
A list containing at least the following components:
- data
A tibble containing raw data or a list of numeric vector
- result
A data.frame consists of summary statistics
- call
the matched call
- attr(*,"measure")
character. One of c("prop","propdiff")
#'@examples propCI(acs$sex) propCI(acs$sex,acs$DM) propCI(n=1600,p=0.4,alpha=0.01) propCI(n=100,p=0.73,P=0.8,alpha=0.01) propCI(n1=400,n2=300,p1=0.4,p2=0.3,alpha=0.1) propCI(n1=100,n2=200,p1=0.38,p2=0.51,alpha=0.01) propCI(n1=100,n2=200,p1=0.38,p2=0.51,alpha=0.01,alternative="less")