R/ci_p_xxx.R
ci_p_agresti_coull.Rd
This function calculates the confidence interval for a proportion. It is vectorized, allowing users to evaluate it using either single values or vectors.
ci_p_agresti_coull(x, n, conf.level = 0.95)
A vector with the lower and upper limits.
The Agresti-Coull interval is an approximate confidence interval for the Binomial proportion \(p\). The limits are calculated based on an adjusted proportion \(\tilde{p}\) and its standard error. The mathematical definitions are as follows: Adjusted proportion: \(\tilde{p}=\frac{x + 2}{n + 4}\); Adjusted standard error: \(se=\sqrt{\frac{\tilde{p}(1 - \tilde{p})}{n + 4}}\); Confidence limits: \(\tilde{p} \pm z_{\alpha/2} \cdot se\),
where \(z_{\alpha/2}\) is the critical value of the standard normal distribution. The limits are truncated to the range \([0, 1]\).
Agresti, A., & Coull, B. A. (1998). Approximate is better than “exact” for interval estimation of binomial proportions. The American Statistician, 52(2), 119-126.
ci_p.
ci_p_agresti_coull(x=15, n=50, conf.level=0.95)
#> [,1]
#> [1,] 0.1909401
#> [2,] 0.4386896