sampler (version 0.2.4)

rsampcalc: Determines random sample size

Description

Determines random sample size

Usage

rsampcalc(N, e, ci = 95, p = 0.5, over = 0)

Arguments

N

population universe (e.g. 10000, nrow(df))

e

tolerable margin of error (integer or float, e.g. 5, 2.5)

ci

(optional) confidence level for establishing a confidence interval using z-score (defaults to 95; restricted to 80, 85, 90, 95 or 99 as input)

p

(optional) anticipated response distribution (defaults to 0.5; takes value between 0 and 1 as input)

over

(optional) desired oversampling proportion (defaults to 0; takes value between 0 and 1 as input)

Value

Returns appropriate sample size (rounded up to nearest integer)

References

[1] Sampling Design & Analysis, S. Lohr, 1999, equation 2.17

Examples

Run this code
# 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