ciss.liubailey {binomSamSize}R Documentation

Sample size calculations using the Liu and Bailey (2002) approach


Calculate sample size for a binomial proportion based on the confidence interval width specification in Liu and Bailey (2002).


ciss.liubailey(alpha, d, lambda.grid = 0:30)



a (1-alpha/2)*100% confidence interval is computed


half width of the confidence interval


range of lambda values to try


The objective is to find the minimum sample size n so that the minimum coverage probability (aka. as the coverage coefficient) of the confidence interval for the binomial parameter is larger than 1-α. In the present approach the confidence interval is of form


as suggested in equation (3.1) of Liu & Bailey (2002):

(\hat{p}_l,\hat{p}_u) = \hat{p}_n + \frac{λ z^2 (0.5-\hat{p}_n)}{n+z^2} \pm d

where \hat{p}_n = x/n. 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.

Given d, fixed lambda and a sample size n, the proportion p in [0,1] where the coverage probability is minimum is computed. The sample size is then gradually increased until this minimum coverage probability becomes larger than 1-α. We then change the value of λ, and search the minimum sample size that guarantee the 1-α confidence level for this lambda value. The smallest minimum sample size over a set of lambda values in lambda.grid is then used as the required sample size; this sample size and the corresponding lambda value are used to calculate the confidence interval given above.

For a general overview of coverage probabilities of confidence intervals for a binomial proportion see Agresti and Coull (1998). Once actual binomial data are obtained the function binom.liubailey can be used to compute the actual confidence interval.

The R function code calls the original Fortran code developed for the Liu and Bailey (2002) article. NAG calls were replaced by R API calls and an R wrapper calling the code as a subroutine was created.


a vector containing the following three elements


sample size at most favorable lambda value in lambda.grid


coverage probability


value in lambda.grid giving the lowest nstar value


M. Höhle and W. Liu


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.

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




[Package binomSamSize version 0.1-5 Index]