powered by
Determines random sample size
rsampcalc(N, e, ci = 95, p = 0.5, over = 0)
population universe (e.g. 10000, nrow(df))
tolerable margin of error (integer or float, e.g. 5, 2.5)
(optional) confidence level for establishing a confidence interval using z-score (defaults to 95; restricted to 80, 85, 90, 95 or 99 as input)
(optional) anticipated response distribution (defaults to 0.5; takes value between 0 and 1 as input)
(optional) desired oversampling proportion (defaults to 0; takes value between 0 and 1 as input)
Returns appropriate sample size (rounded up to nearest integer)
[1] Sampling Design & Analysis, S. Lohr, 1999, equation 2.17
# NOT RUN { rsampcalc(N=5361, e=3, ci=95, p=0.5, over=0.1) rsampcalc(nrow(data), 3) # }
Run the code above in your browser using DataLab