View source: R/bootstrap_weights.r
rescaled.bootstrap.weights | R Documentation |
This function creates a dataset with rescaled bootstrap weights;
it can be a helpful alternative to bootstrap.estimates
in some situations
rescaled.bootstrap.weights( survey.data, survey.design, num.reps, weights = NULL, idvar, verbose = TRUE, parallel = FALSE, paropts = NULL )
survey.data |
The dataset to use |
survey.design |
A formula describing the design of the survey
(see Details in |
num.reps |
the number of bootstrap replication samples to draw |
weights |
weights to use in estimation (or NULL, if none) |
idvar |
the name of the column in |
verbose |
if TRUE, produce lots of feedback about what is going on |
parallel |
if TRUE, use the plyr library's .parallel argument to produce bootstrap resamples and estimates in parallel |
paropts |
if not NULL, additional arguments to pass along to the parallelization routine |
The formula describing the survey design should have the form
~ psu_v1 + psu_v2 + ... + strata(strata_v1 + strata_v2 + ...)
,
where psu_v1, ...
are the variables identifying primary sampling units (PSUs)
and strata_v1, ...
identify the strata
if no summary.fn is specified, then return the list of estimates produced by estimator.fn; if summary.fn is specified, then return its output
survey <- MU284.complex.surveys[[1]] rescaled.bootstrap.weights(survey.data = survey, survey.design = ~ CL, weights='sample_weight', idvar='LABEL', num.reps = 2) ## Not run: bootweights <- rescaled.bootstrap.weights( # formula describing survey design: # psu and strata survey.design = ~ psu + stratum(stratum_analysis), num.reps=10000, # column with respondent ids idvar='caseid', # column with sampling weight weights='wwgt', # survey dataset survey.data=mw.ego) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.