ci_p_wald_cc | R Documentation |
This function calculates the Wald continuity-corrected confidence interval for a Binomial proportion. It is vectorized, allowing the evaluation of single values or vectors.
ci_p_wald_cc(x, n, conf.level = 0.95)
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. |
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.
A vector with the lower and upper limits of the confidence interval.
David Esteban Cartagena Mejía, dcartagena@unal.edu.co
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.
ci_p.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.