Learn R Programming

binomSamSize (version 0.1-3)

binom.liubailey: Calculate fixed width confidence interval for binomial proportion

Description

Calculate a fixed width confidence interval for the the binomial proportion based on one observation from the binomial distribution

Usage

binom.liubailey(x, n, d, lambda=0, conf.level=0.95)

Arguments

x
Vector of number of successes in the binomial experiment.
n
Vector of number of independent trials in the binomial experiment.
conf.level
The level of confidence to be used in the confidence interval
d
half width of the confidence interval
lambda
Shrinkage factor. lambda=0 corresponds to simple $\hat{p} \pm d$ interval.

Value

  • A data.frame containing the observed proportions and the lower and upper bounds of the confidence interval. The style is similar to the binom.confint function of the binom package

Details

The confidence interval is as suggested in equation (3.1) of Liu & Bailey (2002). $$(\hat{p}_l,\hat{p}_u) = (C_n(\hat{p}_n)-d,C_n(\hat{p}_n)+d)$$ The exact form is as follows: Let $z$ be the appropriate $(1-\code{conf.level})/2$ quantile of the standard normal distribution the interval with shrinkage towards 0.5 is given by: $$(\hat{p}_l,\hat{p}_u) = \hat{p}_n + \frac{\lambda z^2 (0.5-\hat{p}_n)}{n+z^2} \pm d$$ The interval is then expanded to a full length of $2d$ using the following transformation: $$\hat{p}_l^* = \max(0,\min( 1-2d, \hat{p}_l))$$ $$\hat{p}_u^* = \min(1,\max( 2d, \hat{p}_u))$$ As a consequence, the computed interval will always have length $2d$.

If fixed length is a desired property of your CI then this is a way to go. However, the Liu and Bailey (2002) confidence intervals can have a low coverage coefficients when $n$ is very small compared to $d$. When using the sample size computation procedure in ciss.liubailey one however ensures that $n$ is large enough for the selected $d$ to guarantee the required coverage coefficient. Thus, one should use binom.liubailey in connection with ciss.liubailey.

References

Liu, W. and Bailey, B.J.R. (2002), Sample size determination for constructing a constant width confidence interval for a binomial success probability. Statistics and Probability Letters, 56(1):1-5.

See Also

ciss.liubailey

Examples

Run this code
binom.liubailey(x=0:20,n=20, d=0.1, lambda=0)

#Compute coverage of this interval
cov <- coverage( binom.liubailey, n=20, alpha=0.05, d=0.1, lambda=0,
                 p.grid=seq(0,1,length=1000))

plot(cov,type="l")

Run the code above in your browser using DataLab