ci_p_arcsine_ac | R Documentation |
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)
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. |
The Arcsine Wald confidence interval with continuity correction anscombe
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{0.3875+x \pm 0.5}{n+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:
\phi=\arcsin(\sqrt{\pi}).
The standard error on the arcsine scale is constant:
\text{se}(\phi)=\frac{1}{2\sqrt{n+0.5}},
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.
A vector with the lower and upper limits of the confidence interval.
David Esteban Cartagena Mejía, dcartagena@unal.edu.co
Anscombe, F.J. (1948). Transformations of Poisson, binomial and negative-binomial data. Biometrika, 35, 246–254
ci_p.
ci_p_arcsine_ac(x= 0, n=50, conf.level=0.95)
ci_p_arcsine_ac(x=15, n=50, conf.level=0.95)
ci_p_arcsine_ac(x=50, n=50, conf.level=0.95)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.