Description Usage Arguments Details Value Author(s) References See Also Examples
Calculate sample size for a binomial proportion based on a mid-p confidence interval width specification.
1 | ciss.midp(p0, d, alpha, nMax=1e6)
|
p0 |
hypothesized upper bound (if below 0.5, if above 0.5 then lower bound) on the parameter p in the binomial distribution |
alpha |
an (1-α/2)\cdot 100\% confidence interval is computed |
d |
half width of the confidence interval |
nMax |
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<f6>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.
1 2 3 4 | #Fosgate approach
ciss.midp(p0=0.2,alpha=0.05,d=0.05)
#Iterative increase of n using the general purpose function
ciss.binom( p0=0.2, alpha=0.05, ci.fun=binom.midp, d=0.05)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.