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
behavior on random-size Poisson designs, especially at multiple
stages, has weaker theoretical backing and should be treated as an
approximation. In particular, the resampling is fixed-size, so it
does not capture the variance contribution of the random sample
size and can materially understate the total variance of a
Poisson-type design. When the exact Poisson linearization is
available (single-stage designs), prefer as_svydesign().
Bounded cube, LPM2, and SCPS designs likewise have no native,
design-specific replicate variance estimator in samplyr.
as_svrepdesign(type = "subbootstrap") and "mrbbootstrap" export a
generic PPS bootstrap approximation for them; they do not reproduce the
original cube constraints or spatial selection algorithm within each
replicate. Treat the resulting variance estimates as approximations, not
as exact variance estimators for those designs.
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.668 3.6922