ci_p_wald_bs | R Documentation |
This function calculates the Wald Binomial Score confidence interval for a Binomial proportion. It is vectorized, allowing the evaluation of single values or vectors.
ci_p_wald_bs(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 Binomial Score confidence interval is an adjusted version of the Wald interval, designed to improve accuracy in small samples and near the boundaries of the parameter space.
The estimated proportion is given by:
\hat{p} = \frac{x}{n}
,
and its complement is:
\hat{q} = 1 - \hat{p}
.
The Wald Binomial Score interval incorporates adjustments for the sample size and confidence level:
\text{wn\_z} = \sqrt{n - z^2 - \frac{2z}{\sqrt{n}} - \frac{1}{n}}
,
where z
is the quantile of the standard normal distribution
corresponding to the confidence level.
The final confidence interval is given by:
\text{Lower} = \hat{p} - \frac{z \sqrt{\hat{p}\hat{q} + \frac{1}{2n}}}{\text{wn\_z}},
\text{Upper} = \hat{p} + \frac{z \sqrt{\hat{p}\hat{q} + \frac{1}{2n}}}{\text{wn\_z}}.
This interval is particularly useful when n
is small or when
the proportion \hat{p}
is close to 0 or 1.
A vector with the lower and upper limits of the confidence interval.
David Esteban Cartagena Mejía, dcartagena@unal.edu.co
Blyth, C.R. and Still, H.A. (1983). Binomial confidence intervals, Journal of the American Statistical Association, 78, 108–116.
ci_p.
ci_p_wald_bs(x = 15, n = 50, conf.level = 0.95)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.