agrestiCoullCI: Agresti-Coull confidence interval for a binomial proportion

View source: R/agrestiCoullCI.R

agrestiCoullCIR Documentation

Agresti-Coull confidence interval for a binomial proportion

Description

Agresti-Coull confidence interval for a binomial proportion

Usage

agrestiCoullCI(n1, n0, q)

Arguments

n1

number of successes/ones

n0

number of failures/zeroes

q

quantile for eventual CI (e.g. 0.95 for a 95 percent binomial CI)

Details

z_\alpha = \Phi^{-1}(1 - \frac{\alpha}{2})

\tilde{n} = n_{\text{successes}} + n_{\text{failures}} + z^2_\alpha

\tilde{p} = \frac{1}{\tilde{n}}(n_{\text{success}} + \frac{z^2_\alpha}{2})

p \approx \tilde{p} \pm z_\alpha \times \sqrt{\frac{\tilde{p}}{\tilde{n}} \times (1 - \tilde{p})}

Value

the approximate (q x 100) percent confidence interval for (p|n1,n0,q)

Examples

agrestiCoullCI(10, 3, 0.95)

biobenkj/compartmentalizer documentation built on June 10, 2025, 1:57 a.m.