ci_p_agresti_coull: Agresti-Coull confidence interval for Binomial proportion

View source: R/ci_p_xxx.R

ci_p_agresti_coullR Documentation

Agresti-Coull confidence interval for Binomial proportion

Description

This function calculates the confidence interval for a proportion. It is vectorized, allowing users to evaluate it using either single values or vectors.

Usage

ci_p_agresti_coull(x, n, conf.level = 0.95)

Arguments

x

A number or a vector with the number of successes.

n

A number or a vector with the number of trials.

conf.level

Confidence level for the returned confidence interval. By default, it is 0.95.

Details

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

Value

A vector with the lower and upper limits.

Author(s)

Omar David Mercado Turizo, omercado@unal.edu.co

References

Agresti, A., & Coull, B. A. (1998). Approximate is better than “exact” for interval estimation of binomial proportions. The American Statistician, 52(2), 119-126.

See Also

ci_p.

Examples

ci_p_agresti_coull(x=15, n=50, conf.level=0.95)


fhernanb/stests documentation built on March 29, 2025, 10:36 a.m.