Skip to contents

Exports a stack_frames() collection to one svyrep.design whose replicate columns are grouped in blocks, one block per frame. In a column belonging to frame q only frame q varies and every other frame stays at its full-sample weight, so the combined variance is the sum of the frames' own contributions, which is what independent selection from each frame gives.

Unlike the linearized route this takes any number of frames, exports a component whose weights were shared from another population, and lets each frame use the replicate method that suits its own design.

Usage

# S3 method for class 'frame_stack'
as_svrepdesign(
  x,
  ...,
  estimator = c("constant", "expected"),
  theta = NULL,
  type = c("auto", "JK1", "JKn", "BRR", "bootstrap", "subbootstrap", "mrbbootstrap",
    "Fay"),
  systematic_variance = c("warn", "approximate", "error")
)

Arguments

x

A frame_stack from stack_frames().

...

Passed to as_svrepdesign() for every component and on to the replicate-weight generator, such as replicates or fay.rho. mse is refused.

estimator

"constant", the default, or "expected", which needs the overlaps declared on the stack. See as_svydesign.frame_stack(), which documents both; here the expected estimator takes any number of frames, since nothing is delegated to survey::multiframe().

theta

The compositing factor for the first frame's overlapping units, a single number in [0, 1], for two frames only. NULL, the default, is the multiplicity estimator and works for any number.

type, systematic_variance

Passed to as_svrepdesign() for every component.

Value

A svyrep.design object from the survey package.

Details

The compositing factor

theta = NULL is the multiplicity estimator: a unit reached by m frames contributes 1/m of its weight through each of them. It is defined for any number of frames and needs nothing stated.

An explicit theta is Hartley's constant factor and applies to two frames only, the first frame of the stack carrying theta of an overlapping unit's weight. Above two frames the factors are per domain rather than per frame, up to 2^K - 1 of them each summing to one over the frames in that domain, so a single number is not a partial answer but a wrong one. It is refused rather than recycled.

Replicate methods may differ between frames

type = "auto" picks a method per component, so a PPS frame can take "subbootstrap" beside a stratified frame taking "JKn". Each block keeps its own component's scale and rscales, folded together so the combined design carries scale = 1, and mixing methods costs nothing: the blocks do not interact.

Centering

Every block is centered at the full combined estimate, which is what makes the block contributions add up. mse is therefore not accepted: with mean-centering survey would center at the mean over all columns and mix the blocks together.

The returned data

The rows are the components' rows in stack order, with .frame and .domain from as.data.frame.frame_stack() in front. .weight holds the composited weight, so it agrees with the design's own. Every other generated column is the component's and describes its selection alone.

References

Lohr, S. L. (2021). Multiple-frame surveys for a multiple-data-source world. Survey Methodology, 47(2), 229-263.

Mecatti, F. (2007). A single frame multiplicity estimator for multiple frame surveys. Survey Methodology, 33(2), 151-157.

Examples

population <- data.frame(
  person_id = 1:200,
  spend = stats::rnorm(200, 100, 10),
  in_landline = rep(c(TRUE, FALSE), times = c(140, 60)),
  in_cell = rep(c(FALSE, TRUE), times = c(60, 140))
)

frames <- stack_frames(
  landline = sampling_design() |>
    draw(n = 40) |>
    execute(population[population$in_landline, ], seed = 1),
  cell = sampling_design() |>
    draw(n = 50) |>
    execute(population[population$in_cell, ], seed = 2),
  membership = c(landline = "in_landline", cell = "in_cell"),
  key = person_id
)

rep_svy <- as_svrepdesign(frames, type = "bootstrap", replicates = 50)
survey::svytotal(~spend, rep_svy)
#>       total     SE
#> spend 20143 647.35