ci_p_wald: Wald confidence interval for Binomial proportion

View source: R/ci_p_xxx.R

ci_p_waldR Documentation

Wald 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_wald(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 is 0.95.

Details

The expression to obtain the confidence interval is given below:

\hat{p} - z_{\alpha/2} \sqrt{\frac{\hat{p}(1 - \hat{p})}{n}} \leq p \leq \hat{p} + z_{\alpha/2} \sqrt{\frac{\hat{p}(1 - \hat{p})}{n}},

where \hat{p}=\frac{x}{n} is the sample proportion, x the number of observed successes in the sample with size n. The value z_{\alpha/2} is the 1-\alpha/2 percentile of the standard normal distribution (e.g., z_{0.025}=1.96 for a 95% confidence interval).

Value

A matrix with the lower and upper limits.

Author(s)

Olga Bustos, oabustos@unal.edu.co

References

Wald, A. (1949). Statistical decision functions. The Annals of Mathematical Statistics, 165-205.

See Also

ci_p.

Examples

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


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