Skip to contents

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_sample object produced by execute().

...

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".

Value

A svyrep.design object from the survey package.

Details

Replicate conversion supports single-phase designs. For PPS designs, "subbootstrap" and "mrbbootstrap" are the supported replicate types. Other types emit a warning and may fail because PPS inclusion probabilities vary within strata. For PPS variance estimation, linearization via as_svydesign() (with Brewer approximation or exact joint probabilities) is generally preferred. Two-phase designs should be exported with as_svydesign().

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 206.87 4.6854