ci_p_arcsine_cc: Arcsine Wald Confidence Interval with Continuity Correction...

View source: R/ci_p_xxx.R

ci_p_arcsine_ccR Documentation

Arcsine Wald Confidence Interval with Continuity Correction 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_arcsine_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 Arcsine Wald confidence interval with continuity correction adjusts the classical Wald interval by transforming the proportion \pi to the arcsine scale. The parameter \pi represents the true proportion of successes in a Binomial experiment, defined as:

\pi=\frac{x \pm 0.5}{n},

where x is the number of successes and n is the number of trials.

On the arcsine scale, the transformed parameter is given by:

\phi=\arcsin(\sqrt{\pi}).

The standard error on the arcsine scale is constant:

\text{se}(\phi)=\frac{1}{\sqrt{4n}},

where n is the number of trials. The confidence interval on the arcsine scale is:

\text{Lower}(\phi)=\max\left(0, \phi - z \cdot (\phi)\right),

\text{Upper}(\phi)=\min\left(\frac{\pi}{2}, \phi + z \cdot (\phi)\right),

where z is the critical value from the standard normal distribution at the specified confidence level.

Back-transforming the limits to the original scale gives:

\text{Lower}(\pi)=\sin^2(\text{Lower}(\phi)),

\text{Upper}(\pi)=\sin^2(\text{Upper}(\phi)).

Special cases are handled explicitly:

- If x=0, the lower limit is 0, and the upper limit is calculated as (\alpha / 2)^{1/n}.

- If x=n, the upper limit is 1, and the lower limit is calculated as 1 - (\alpha / 2)^{1/n}.

These adjustments ensure that the confidence interval is valid and well-behaved, 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

Missing reference.

See Also

ci_p.

Examples

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


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