ciss.midp {binomSamSize}R Documentation

Sample size calculations using the Fosgate (2005) approach


Calculate sample size for a binomial proportion based on a mid-p confidence interval width specification.


ciss.midp(p0, d, alpha, nMax=1e6)



hypothesized upper bound (if below 0.5, if above 0.5 then lower bound) on the parameter p in the binomial distribution


an (1-α/2)\cdot 100\% confidence interval is computed


half width of the confidence interval


Largest n to check. Interrupt iterations when this value is reached


Fosgate (2005) discusses the need for improved sample size calculations in cases where the binomial proportion is close to 0 and 1. To improve on this, calculation on confidence intervals based on the mid-p method are suggested where computation of the upper and lower limit are combined into one formula. Given lower and upper bounds p_l and p_u of the (1-alpha)*100% confidence interval, one finds the sample size n as the solution to

\frac{1}{2} f(x;n,p_l) + \frac{1}{2} f(x;n,p_u) + (1 - F(x;n,p_l)) + F(x-1;m,p_u) = α

where f(x;n,p) denotes the probability mass function (pmf) and F(x;n,p) the (cumulative) distribution function of the binomial distribution with size n and proportion p evaluated at x. The function then returns \lceil n \rceil. Note that in this approach (p_l,p_u) = p_0 \pm d, which has to be a subset of (0,1). Another option would be to choose the lower and upper independent specifically.

In the above, x is found as the integer value, such that x/n is as close as possible to the hypothesized value p0 as possible.

An alternative approach to determine sample sizes based on the mid-p approach is to manually find the sample size n such that the interval obtained by binom.midp has a length less than 2\cdot d.


the necessary sample size n


M. Höhle


Fosage, G.T. (2005) Modified exact sample size for a binomial proportion with special emphasis on diagnostic test parameter estimation, Statistics in Medicine 24(18):2857-66.

See Also

binom.midp, ciss.binom


#Fosgate approach
#Iterative increase of n using the general purpose function
ciss.binom( p0=0.2, alpha=0.05,, d=0.05)

[Package binomSamSize version 0.1-5 Index]