ci_p_wald_cc: Wald Continuity-Corrected confidence interval for Binomial...

View source: R/ci_p_xxx.R

ci_p_wald_ccR Documentation

Wald Continuity-Corrected confidence interval for Binomial proportion

Description

This function calculates the Wald continuity-corrected confidence interval for a Binomial proportion. It is vectorized, allowing the evaluation of single values or vectors.

Usage

ci_p_wald_cc(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 Wald continuity-corrected confidence interval adjusts the standard Wald interval for small sample sizes or when the proportion \hat{p} is near 0 or 1. It incorporates a continuity correction to improve accuracy.

The estimated proportion is given by:

\hat{p} = \frac{x}{n},

and its complement is:

\hat{q} = 1 - \hat{p}.

The continuity-corrected interval incorporates the critical value z from the standard normal distribution:

\text{Lower} = \hat{p} - z \sqrt{\frac{\hat{p}\hat{q}}{n}} - \frac{1}{2n},

\text{Upper} = \hat{p} + z \sqrt{\frac{\hat{p}\hat{q}}{n}} + \frac{1}{2n}.

These adjustments ensure that the confidence interval is valid even at the boundaries of the parameter space.

Value

A vector with the lower and upper limits of the confidence interval.

Author(s)

David Esteban Cartagena Mejía, dcartagena@unal.edu.co

References

Pires, Ana M., and Conceiçao Amado. "Interval estimators for a binomial proportion: Comparison of twenty methods". REVSTAT-Statistical Journal 6.2 (2008): 165-197.

See Also

ci_p.

Examples

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


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