binom_ci: Binomial confidence intervals

View source: R/statistical_tests_and_estimates.R

binom_ciR Documentation

Binomial confidence intervals

Description

[Stable]

Wrapper for binom::binom.confint

Usage

binom_ci(x, conf.level = 0.95, methods = "wilson", ...)

Arguments

x

vector of type integer (0/1) or logical (TRUE/FALSE)

conf.level

confidence level (between 0 and 1). Default is 0.95.

methods

which method to use to construct the interval. Any combination of c("exact", "ac", "asymptotic", "wilson", "prop.test", "bayes", "logit", "cloglog", "probit") is allowed or "all". Default is "wilson".

...

Additional arguments to be passed to binom::binom.bayes

Details

See binom::binom.confint for method details

Value

data.frame with with mean (mean), and bounds of confidence interval (lower, upper)

Returns a data frame with the following columns:

  • method - method(s) selected

  • x - number of successes in the binomial experiment

  • n - number of independent trials in the binomial experiment

  • mean - success proportion mean

  • lower - success proportion lower bound

  • upper - success proportion upper bound

Examples


x <- c(rep(0, 500), rep(1, 500))
binom_ci(x, conf.level = .90, methods = 'all')


FredHutch/VISCfunctions documentation built on Oct. 14, 2024, 11:33 p.m.