BinomCIn {DescTools} | R Documentation |
Sample Size for a Given Width of a Binomial Confidence Interval
Description
Returns the necessary sample size to achieve a given width of a binomial confidence interval, as calculated by BinomCI()
. The function uses uniroot()
to find a numeric solution.
Usage
BinomCIn(p = 0.5, width, interval = c(1, 100000),
conf.level = 0.95, sides = "two.sided", method = "wilson")
Arguments
p |
probability for success, defaults to |
width |
the width of the confidence interval |
interval |
a vector containing the end-points of the interval to be searched for the root. The defaults are set to |
conf.level |
confidence level, defaults to |
sides |
a character string specifying the side of the confidence interval, must be one of |
method |
character string specifing which method to use; this can be one out of:
|
Details
The required sample sizes for a specific width of confidence interval depends on the proportion in the population. This value might be unknown right from the start when a study is planned. In such cases the sample size needed for a given level of accuracy can be estimated using the worst case percentage which is p=50%. When a better estimate is available you can you can use it to get a smaller interval.
Value
a numeric value
Author(s)
Andri Signorell <andri@signorell.net>
See Also
BinomCI()
Examples
BinomCIn(p=0.1, width=0.05, method="pratt")