This function calculates the confidence interval for a proportion. It is vectorized, allowing users to evaluate it using either single values or vectors.

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.

Value

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

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.

References

Missing reference.

See also

Author

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

Examples

ci_p_arcsine_cc(x= 0, n=50, conf.level=0.95)
#>            [,1]
#> lower 0.0000000
#> upper 0.9288783
ci_p_arcsine_cc(x=15, n=50, conf.level=0.95)
#>            [,1]
#> lower 0.1738458
#> upper 0.4438112
ci_p_arcsine_cc(x=50, n=50, conf.level=0.95)
#>             [,1]
#> lower 0.07112174
#> upper 1.00000000