Learn R Programming

rifttable (version 0.7.2)

scoreci: 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)

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 (for return_midpoint = TRUE).

  • level Confidence level.

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 FALSE.

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. tools:::Rd_expr_doi("10.2307/2685469")

Brown LD, Cai TT, DasGupta A. Interval estimation for a binomial proportion (with discussion). Stat Sci 2001;16:101-133. tools:::Rd_expr_doi("10.1214/ss/1009213286")

Examples

Run this code
scoreci(success = 5, total = 10)
scoreci(success = c(5:10), total = 10, level = 0.9)

Run the code above in your browser using DataLab