Creates a svyrep.design object from a tbl_sample by first
converting to a survey::svydesign() object via as_svydesign(),
then converting with survey::as.svrepdesign().
Usage
as_svrepdesign(x, ...)
# S3 method for class 'tbl_sample'
as_svrepdesign(
x,
...,
type = c("auto", "JK1", "JKn", "BRR", "bootstrap", "subbootstrap", "mrbbootstrap",
"Fay")
)Arguments
- x
A
tbl_sampleobject produced byexecute().- ...
Additional arguments passed to
survey::as.svrepdesign().- type
Replicate method passed to
survey::as.svrepdesign(). One of"auto","JK1","JKn","BRR","bootstrap","subbootstrap","mrbbootstrap", or"Fay".
Details
Replicate conversion supports single-phase designs. For unequal-probability
designs (PPS or random-size Poisson), "subbootstrap" and "mrbbootstrap"
are the supported replicate types. Other types emit a warning and may fail
because inclusion probabilities vary within strata. For fixed-size PPS
variance estimation, linearization via as_svydesign() is generally
preferred. Two-phase designs should be exported with as_svydesign().
Bootstrap escape hatch for random-size Poisson at stage 1
Some designs cannot be expressed as a linearization-based
survey::svydesign() object. Specifically, multi-stage designs with
a random-size Poisson method (bernoulli or pps_poisson) at stage 1,
and single-stage designs with cluster_by() and multiple rows per
sampled cluster, are rejected by as_svydesign() for those methods.
For these cases as_svrepdesign(type = "subbootstrap") (or
"mrbbootstrap") is the recommended path. The design is exported with
a permissive specification (no finite-population correction at the
Poisson stage, no pps argument), and the bootstrap resampler supplies
the variance through replicate weights.
This is the package's bootstrap approximation for designs that exact
Horvitz-Thompson linearization cannot express in
survey::svydesign(). The subbootstrap and mrbbootstrap methods were
developed for fixed-size PPS sampling (Antal and Tille 2011); their
behaviour on random-size Poisson designs, especially at multiple
stages, has weaker theoretical backing and should be treated as an
approximation.
See also
as_svydesign() for linearization export,
survey::as.svrepdesign() for the underlying conversion
Examples
sample <- sampling_design() |>
stratify_by(region, alloc = "proportional") |>
draw(n = 300) |>
execute(bfa_eas, seed = 42)
rep_svy <- as_svrepdesign(sample, type = "auto")
survey::svymean(~households, rep_svy)
#> mean SE
#> households 71.979 3.679