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_rindskopf(x, n, conf.level = 0.95)
A vector with the lower and upper limits.
The expression to calculate the confidence interval according to the Rindskopf approach is given by:
\(\phi=\text{logit}(\pi)=\log\left(\frac{\pi}{1 - \pi}\right)\),
where the maximum likelihood estimator for \(\phi\) is:
\(\hat{\phi}_{ML}=\log\left(\frac{x + 0.5}{n - x + 0.5}\right)\),
and its standard error is:
\(\text{se}(\hat{\phi}_{ML})=\sqrt{\frac{1}{x + 0.5} + \frac{1}{n - x + 0.5}}\).
The adjustment of adding 0.5 successes and non-successes ensures that intervals can also be computed for the cases where \(x=0\) or \(x=n\) (where otherwise the maximum likelihood estimator and standard error would be infinite).
Since the scale of \(\phi\) is \((- \infty, \infty)\), this interval respects the boundary constraints. Back-transformation to the scale of \(\pi\) is performed using the inverse logit function:
\(\pi=\text{expit}(\phi)=\frac{\exp(\phi)}{1 + \exp(\phi)}\).
Thus, the confidence interval for \(\pi\) in the original scale is the Rindskopf confidence interval, as proposed by Rindskopf.
Rindskopf, D. (2000). Commentary: Approximate is better than “exact” for interval estimation of binomial proportions. The American Statistician, 54, 88.
ci_p.
ci_p_rindskopf(x=15, n=50, conf.level=0.95)
#> [,1]
#> [1,] 0.1938182
#> [2,] 0.4422596