Takes a sample with or without replacement from the population.
Arguments
- N
population size.
- n
sample size.
- strata
(optional) vector of stratification variables. If provided must be of length
N
- balance
logical, whether to (try to) balance the strata frequency in the output sample. Used only if
strata
is provided.- replace
logical, whether to sample with replacement. Default is
FALSE
. Set toTRUE
for bootstrap method.
Details
If strata
is provided, sampling is applied within each stratum, with the strategy
depending on balance
. If balance = FALSE
, the proportion of the strata
in the population is maintained in the samples (also called "proportionate allocation").
If balance = TRUE
, the proportion of strata in the sample is attempted to be balanced.