binWidth {binGroup}R Documentation

Calculate the expected width of a confidence interval for a single binomial proportion

Description

Calculation of expected value of the width of confidence intervals in binomial group testing, in dependence of the number of trials (number of individuals under observation), confidence level and an assumed true proportion. Available for the confidence interval methods in binCI(binGroup).

Usage

binWidth(n, p, conf.level = 0.95,
 alternative = "two.sided", method = "CP")

Arguments

n integer, giving the number of trials (i.e. number of individuals under observation)
p assumed true proportion of individuals showing the trait to be estimated
conf.level required confidence level of the interval
alternative character string, defining the alternative hypothesis, either 'two.sided', 'less' or 'greater' where 'less' calculates the expected width between the assumed true proportion p and the upper conf.level*100 percent-bound of a one-sided CI, 'greater' calculates the expected width between the assumed true proportion p and the lower conf.level*100 percent-bound of a one-sided CI, 'two.sided' calculates the expected width between the lower and the upper bound of a two-sided conf.level*100 percent-CI.
method character string defining the method for CI calculation: where "CP" is Clopper-Pearson, an exact tail interval showing symmetric coverage probability (inversion of two one-sided tests), "Blaker" is the Blaker interval, an exact interval, inversion of one two.sided test, therefore defined only two.sided, but shorter than the two-sided Clopper-Pearson CI. Both guarantee to contain the true parameter with at least conf.level*100 percent probability, "AC" is Agresti-Coull, generalized Agresti-Coull interval, asymptotic method, "Score" is Wilson Score, asymptotic method derived from inversion of the Score test, "SOC" is the second order corrected interval, asymptotic method for one-sided problems (for details see Cai, 2005), and "Wald" the Wald interval, which cannot be recommended.

Details

For calculation of expected interval width in the standard binomial estimation see f.e. Brown et al. 2001.

Value

A list containing:

expCIWidth the expected value of the width of the confidence interval for the specified arguments


and the alternative, p and n which are specified in the function call.

References

Brown LD, Cai TT, DasGupta A (2001): Interval estimation for a binomial proportion. Statistical Science 2001, Vol.16, No.2, 101-133.

See Also

binDesign for experimental design for hypothesis testing

Examples


# methods differ slightly in length:

binWidth(n=200,p=0.02,alternative="two.sided", method="CP")$expCIWidth
binWidth(n=200,p=0.02,alternative="two.sided", method="Blaker")$expCIWidth
binWidth(n=200,p=0.02,alternative="two.sided", method="Score")$expCIWidth

# but do more for small sample sizes and intermediate p:

binWidth(n=20,p=0.2,alternative="two.sided", method="CP")$expCIWidth
binWidth(n=20,p=0.2,alternative="two.sided", method="Blaker")$expCIWidth
binWidth(n=20,p=0.2,alternative="two.sided", method="Score")$expCIWidth


[Package binGroup version 0.3-2 Index]