Description Usage Arguments Details Value Author(s) References Examples
For a given true value of the proportion compute the coverage probability of the confidence interval
1 2 3 4 |
ci.fun |
|
n |
Sample size of the binomial distribution. |
alpha |
Level of significance, 1-α is the confidence level. |
p.grid |
Vector of proportions where to evaluate the confidence
interval function. If |
interval |
Vector of length two specifying lower and upper border of an interval of interest for the proportion. The intersection of the above grid and this interval is taken. |
pmfX |
A function based on the arguments |
x |
An object of class |
y |
Not used |
... |
Further arguments to be sent to |
Compute coverage probabilities for each proportion in
p.grid. See actual function code for the exact details, which
p.grid is actually chosen.
An object of class coverage containing coverage probabilities,
coverage coefficient and more.
M. H<f6>hle
Agresti, A. and Coull, B.A. (1998), Approximate is Better than "Exact" for Interval Estimation of Binomial Proportions, The American Statistician, 52(2):119-126.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #Show coverage of Liu & Bailey interval
cov <- coverage( binom.liubailey, n=100, alpha=0.05,
p.grid=seq(0,1,length=1000), interval=c(0,1), lambda=0, d=0.1)
plot(cov, type="l")
#Now for some more advanced stuff. Investigate coverage of pooled
#sample size estimators
kk <- 10
nn <- 20
ci.funs <- list(poolbinom.wald, poolbinom.logit, poolbinom.lrt)
covs <- lapply( ci.funs, function(f) {
coverage( f, n=nn, k=kk, alpha=0.05, p.grid=seq(0,1,length=100),
pmfX=function(k,n,p) dbinom(k,size=n, p=1-(1-p)^kk))
})
par(mfrow=c(3,1))
plot(covs[[1]],type="l",main="Wald",ylim=c(0.8,1))
lines(c(0,1),rep(0.95,2),lty=2,col=2)
plot(covs[[2]],type="l",main="Logit")#,ylim=c(0.8,1))
lines(c(0,1),rep(0.95,2),lty=2,col=2)
plot(covs[[3]],type="l",main="LRT",ylim=c(0.8,1))
lines(c(0,1),rep(0.95,2),lty=2,col=2)
poolbinom.wald(x=1,n=nn,k=kk)
poolbinom.logit(x=1,n=nn,k=kk)
poolbinom.lrt(x=1,n=nn,k=kk)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.