nWilson: Calculate a simple random sample size for estimating a...

View source: R/nWilson.R

nWilsonR Documentation

Calculate a simple random sample size for estimating a proportion

Description

Calculate a simple random sample size for estimating a proportion using the Wilson method.

Usage

nWilson(moe.sw, alpha = 0.05, pU, e)

Arguments

moe.sw

switch for setting desired margin of error (1 = CI half-width on the proportion; 2 = CI half-width on a proportion divided by pU)

alpha

1 - (confidence level)

pU

population proportion

e

desired margin of error; either the value of CI half-width or the value of the half-width divided by pU

Details

Calculate a simple random sample size using the Wilson (1927) method. A margin of error can be set as the CI half-width on the proportion (moe.sw=1) or as the CI half-width as a proportion of the population value p_U (moe.sw=2).

Value

n.sam

numeric sample size

"CI lower limit"

lower limit of Wilson confidence interval with computed sample size

"CI upper limit"

upper limit of Wilson confidence interval with computed sample size

"length of CI"

length of Wilson confidence interval with computed sample size

Author(s)

Richard Valliant, Jill A. Dever, Frauke Kreuter

References

Valliant, R., Dever, J., Kreuter,F. (2018, chap. 3). Practical Tools for Designing and Weighting Survey Samples, 2nd edition. New York: Springer.

Wilson, E.B. (1927). Probable inference, the law of succession, and statistical inference. Journal of the American Statistical Association, 22, 209-212.

See Also

nCont, nLogOdds, nProp, nPropMoe

Examples

# srs sample size using Wilson method so that half-width of a 95% CI
# is 0.01. Population proportion is 0.04
nWilson(moe.sw = 1, pU = 0.04, e = 0.01)

PracTools documentation built on June 25, 2024, 1:12 a.m.