scoreci {rifttable} | R Documentation |
Wilson Score Confidence Intervals
Description
"This function computes a confidence interval for a proportion. It is based on inverting the large-sample normal score test for the proportion." (Alan Agresti, who wrote the original R code)
Inputs for success
, total
, and level
are vectorized.
Usage
scoreci(success, total, level = 0.95, return_midpoint = FALSE)
Arguments
success |
Success count. |
total |
Total count. |
level |
Optional. Confidence level. Defaults to 0.95. |
return_midpoint |
Optional. Return midpoint of confidence
interval? Defaults to |
Value
Data frame:
-
success
Success count -
total
Total count -
estimate
Proportion -
conf.low
Lower bound of the confidence interval. -
conf.high
Upper bound of the confidence interval. -
midpoint
Mid-point of the confidence interval (forreturn_midpoint = TRUE
). -
level
Confidence level.
See Also
https://users.stat.ufl.edu/~aa/cda/R/one-sample/R1/index.html
Agresti A, Coull BA. Approximate is better than "exact" for interval estimation of binomial proportions. Am Stat 1998;52:119-126. doi:10.2307/2685469
Brown LD, Cai TT, DasGupta A. Interval estimation for a binomial proportion (with discussion). Stat Sci 2001;16:101-133. doi:10.1214/ss/1009213286
Examples
scoreci(success = 5, total = 10)
scoreci(success = c(5:10), total = 10, level = 0.9)