Processing math: 47%

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_ac(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 anscombe adjusts the classical Wald interval by transforming the proportion π to the arcsine scale. The parameter π represents the true proportion of successes in a Binomial experiment, defined as:

π=0.3875+x±0.5n+0.75,

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

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

ϕ=arcsin(π).

The standard error on the arcsine scale is constant:

se(ϕ)=12n+0.5,

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

Lower(ϕ)=max \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

Anscombe, F.J. (1948). Transformations of Poisson, binomial and negative-binomial data. Biometrika, 35, 246–254

See also

Author

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

Examples

ci_p_arcsine_ac(x= 0, n=50, conf.level=0.95)
#>           [,1]
#> [1,] 0.0000000
#> [2,] 0.9288783
ci_p_arcsine_ac(x=15, n=50, conf.level=0.95)
#>           [,1]
#> [1,] 0.1769659
#> [2,] 0.4461410
ci_p_arcsine_ac(x=50, n=50, conf.level=0.95)
#>            [,1]
#> [1,] 0.07112174
#> [2,] 1.00000000