Skip to contents

Returns the probability that each unit of a register would be selected, computed from the design rather than observed from a sample. It draws no random numbers, and it needs no execution.

The intended use is a survey covering one population through several registers, where the expected multiframe estimator needs a unit's chance in the frames it was not selected from. See exante_overlaps(), which resolves those chances for a whole stack_frames() collection.

Usage

exante_probabilities(design, frame, key)

Arguments

design

A sampling_design with a complete draw() on every stage.

frame

The register, a data frame.

key

A bare column of frame identifying the population unit. It must be unique.

Value

A tibble with the key column and probability, one row per unit, in the register's own order.

Details

The probability is compounded across stages: for a two-stage design it is the chance the unit's cluster is selected times the chance the unit is selected within it. The stage-by-stage quantities come from the same allocation and chance resolvers execution uses, so a sample's own weights reproduce these numbers exactly.

What it refuses

A with-replacement or minimum-replacement stage, because the quantity there is an expected number of hits rather than an inclusion probability, and a method whose registered probabilities are "unknown". It also refuses a design given several registers, one per stage: the compounding runs along the rows of one register and there is no correspondence between the rows of two.

frame_summary() answers a different question. It reports the pools and chances a design resolves, at whatever resolution the digest retained, and returns no unit rows at all where that was a quantile summary.

References

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

Examples

register <- data.frame(
  person_id = 1:40,
  size = rep(c(2, 5, 3, 8), times = 10)
)

design <- sampling_design() |>
  draw(n = 10, method = "pps_brewer", mos = size)

head(exante_probabilities(design, register, key = person_id))
#> # A tibble: 6 × 2
#>   person_id probability
#>       <int>       <dbl>
#> 1         1       0.111
#> 2         2       0.278
#> 3         3       0.167
#> 4         4       0.444
#> 5         5       0.111
#> 6         6       0.278

# The design's own sample carries the same numbers, as 1 / .weight.
sample <- execute(design, register, seed = 1)
resolved <- exante_probabilities(design, register, key = person_id)
all.equal(
  resolved$probability[match(sample$person_id, resolved$person_id)],
  1 / sample$.weight
)
#> [1] TRUE