MeanCIn: Sample Size for a Given Width of a Confidence Interval for a Mean
Description
Returns the required sample size to obtain a given width of a confidence interval for the sample mean. The function uses uniroot() to find a numeric solution. The t distribution is used.
the left and right bound of the interval, which is presumed to be symmetric.
sd
the standard deviation of the sample.
interval
the interval for the sample size to be searched into, (default is c(2, 100000)).
conf.level
confidence level, defaults to 0.95.
norm
logical, determining if the t- or normaldistribution should be used.
tol
the desired accuracy (convergence tolerance).
Value
a numeric value
Details
The required sample sizes for a specific width of confidence interval for the mean depends recursively on the sample size, as the samplesize defines the degrees of freedom in the t-distribution. Although in most practical cases it will be sufficient to use the normal distribution, we might be interested in exact results.