ciss.pool.wald | R Documentation |
Calculate sample size for a binomial proportion based on Wald type confidence interval for pooled samples using a perfect test
ciss.pool.wald(pi0, alpha, d, k)
pi0 |
hypothesized upper bound (if below 0.5, if above 0.5 then
lower bound) on the parameter |
alpha |
an |
d |
half width of the confidence interval |
k |
The pool size |
Sample size calculation based on width of Wald confidence intervals for pooled sample. The equation is
n = \left\lceil \left( \frac{z_{1-\alpha/2} (1-\pi_0)}{d k}
\right)^2 \cdot \left((1-\pi_0)^{-k} - 1\right) \right\rceil
the necessary sample size n
M. Höhle
D. D. Worlund and G. Taylor (1983), Estimation of Disease Incidence in Fish Populations, Can. J. Fish. Aquat. Sci., 40:2194-2197.
poolbinom.wald
k <- 1:50
n <- sapply(k, function(k) ciss.pool.wald(pi0=0.1, alpha=0.05,k=k, d=0.05))
#sizes <- cbind(k=k, n=n, N=n*k)
plot(k, n, type="s",xlab="Pool size",ylab="Number of pools")
plot(k*n,n,type="s",xlab="Total size",ylab="Number of pools")
ciss.pool.wald(pi0=0.1, d=0.01, alpha=0.05, k=10)
#Compare with ciss.binom function
np02x <- function(n,p0,k) round( (1-(1-p0)^k)*n )
(n <- ciss.binom( p0=0.1, d=0.01, alpha=0.05, ci.fun=poolbinom.wald,
np02x=np02x, k=10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.