| bootstrap_weights | R Documentation |
Builds bootstrap replicate weights by resampling primary sampling units (PSUs) with replacement within strata and re-running the whole recipe on each replicate. Because every adjustment (nonresponse, calibration, ...) is recomputed per replicate, the resulting replicate weights propagate the variability introduced by each weighting stage.
bootstrap_weights(
object,
replicates = 200L,
strata = NULL,
psu = NULL,
m = NULL,
seed = NULL,
progress = TRUE
)
object |
a |
replicates |
number of bootstrap replicates. |
strata, psu |
column names of the stratum and the PSU. If |
m |
PSUs drawn per stratum (default |
seed |
optional RNG seed. |
progress |
print progress every 25 replicates. |
The multiplier is the Rao-Wu rescaling bootstrap: within a stratum with
n PSUs, m PSUs are drawn with replacement (default
m = n - 1) and unit i in PSU k gets
\lambda = 1 - \sqrt{m/(n-1)} + \sqrt{m/(n-1)}\,(n/m)\,t_k, with
t_k the number of times its PSU was drawn.
An object of class weightflow_boot with the replicates matrix
(units x replicates), the point weights, and the design metadata.
spec <- weighting_spec(sample_survey, base_weights = pw) |>
step_calibrate(method = "raking",
margins = list(region = c(table(population$region))))
boot <- bootstrap_weights(spec, replicates = 50, strata = "region",
psu = "psu", seed = 1)
boot_total(boot, "responded")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.