poolbinom.wald(x, k, n, conf.level=0.95)
poolbinom.logit(x, k, n, conf.level=0.95)
binom.confint
function of the binom
packageNow, instead of considering each individual the $k\cdot n$ samples are pooled into $n$ pools each of size $k$. A pool is positive if there is at least one positive in the pool. Let X be the number of positive pools. Then $$X \sim Bin(n, 1-(1-\pi)^k)$$.
The present function computes an estimator and confidence interval for
$\pi$ by computing the MLE and standard error for
$\hat{\pi}$. A Wald confidence interval is formed using
$\hat{\pi} \pm z_{1-\alpha/2}\cdot se(\hat{\pi})$. In case of
poolbinom.logit
a logit transformation is used, i.e. the
standard error for $logit(\hat{\pi})$ is computed and the Wald-CI
is derived on the logit-scale which is then backtransformed using the
inverse logit function. In case $x=0$ or $x=n$ the logit of
$\hat{\pi}$ is not defined and hence the confidence interval is
not defined in these two situation. To fix the problem we use the
intervals $(0,
\hat{\pi}_u(x=0))$ and $(\hat{\pi}_l(x=n),1)$, respectively, where
$\pi_u$ and $\pi_o$ are the respective borders of a
corresponding LRT interval.
The poolbinom.wald
approach corresponds to method 2 in the
Cowling et al. (1999). The logit transformation improves on this
procedure, because the method ensures that the interval is in the
range (0,1).
poolbinom.lrt
poolbinom.wald(x=0, k=10, n=34, conf.level=0.95)
poolbinom.logit(x=0:1, k=10, n=34, conf.level=0.95)
poolbinom.logit(x=1, k=seq(10,100,by=10), n=34, conf.level=0.95)
poolbinom.logit(x=0:34,k=1,n=34)
Run the code above in your browser using DataLab