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)

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.

Value

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

Details

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 bounds for the interval confidence are:

\(\hat{p} \mp \left[ \frac{Z_{\alpha/2} \sqrt{\hat{p} (1-\hat{p})}}{\sqrt{n - Z_{\alpha/2}^2 - \frac{2Z_{\alpha/2}}{\sqrt{n}} - \frac{1}{n}}} + \frac{1}{2n} \right]\)

This interval is particularly useful when \(n\) is small or when the proportion \(\hat{p}\) is close to 0 or 1.

References

Blyth, C.R. and Still, H.A. (1983). Binomial confidence intervals, Journal of the American Statistical Association, 78, 108–116.

See also

Author

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

Examples

ci_p_wald_bs(x = 15, n = 50, conf.level = 0.95)
#>           [,1]
#> [1,] 0.1629798
#> [2,] 0.4370202