Undoes a second phase of sampling: when a subsample of the first-phase units was drawn for a more expensive follow-up (measuring an outcome, a longer questionnaire), the subsampled units must represent the whole first-phase sample. Their weight is multiplied by the inverse of the phase-2 selection probability, and the not-subsampled units leave the cascade (weight 0).
Arguments
- spec
a weighting_spec.
- selected
a 0/1 dummy column (1 = selected in phase 2) or any logical condition (unquoted) TRUE for the subsampled units. Units that are not selected leave the cascade (weight 0).
- prob
unquoted column with the phase-2 selection probability \(\pi_2\) of the selected units. The weight is multiplied by 1/prob. Must be in (0, 1] for every selected unit and constant within each phase-2 sampling unit.
- psu
character. The phase-2 sampling unit column (e.g. the household id at which the subsample was drawn). The two-phase resampling factor is generated at this level and shared by the members of the unit.
- id
optional string: a stable identifier for this step, shown in the recipe print-out and usable to select it in
collect_step_detail(); defaults to a derived"<class>_<k>".
Value
The input weighting_spec with this step appended to its recipe. The
step is recorded only; it is evaluated when prep() is called.
Details
The step also records the phase-2 design (the selection probability and the
phase-2 sampling unit) so that
bootstrap_weights() can reproduce the two-phase variance
\(V = V_1 + V_2\): the phase-1 sampling variance plus the
expected conditional variance of the phase-2 subsample. A single-phase
bootstrap would only capture \(V_1\) and undercover.
The coupling is additive, not multiplicative: the per-unit resampling factor
has variance \((1-f_1)\pi_2 + (1-\pi_2)\), the
sum of the phase-1 component \((1-f_1)\pi_2\) (seen through
the subsample) and the phase-2 conditional component
\(1-\pi_2\). A naive product of two factors adds a spurious
interaction term and is too wide. In practice the factor is drawn once per
phase-2 sampling unit from a strictly positive Gamma of that mean and
variance, so every replicate weight stays positive (a downstream
propensity/GLM step re-runs cleanly). See vignette("two-phase-sampling") for
the methodology and its Monte Carlo validation.
The second phase is modelled as Poisson (independent / Bernoulli) selection of
the sampling unit nested in the first phase (e.g. households subsampled from a
first-phase household sample). This is the general-purpose choice: a Poisson
second phase is conservative for, and closely approximates, the without-
replacement and stratified subsampling schemes used in practice when the
phase-2 sampling fraction is small – which is the usual case, since a costly
follow-up subsamples only a fraction of the first phase. The phase-1 sampling
fraction \(f_1\) is
taken from the fpc argument of bootstrap_weights() and defaults to 0
(negligible, the usual case in household surveys), which reduces the coupling
to a single independent per-unit factor of variance 1 – a Gamma of variance 1,
i.e. an Exponential(1) (the Bayesian-bootstrap multiplier): valid and strictly
positive, but right-skewed, which is part of why replicate-to-replicate
variance estimates have heavier tails.
See also
bootstrap_weights() for the two-phase variance; step_select_within()
for within-cluster subsampling that is not a separate sampling phase.
Other weighting steps:
step_assert(),
step_calibrate(),
step_cre(),
step_drop_ineligible(),
step_model_calibration(),
step_nonresponse(),
step_nr_sensitivity(),
step_pseudoweight(),
step_rescale(),
step_round(),
step_select_within(),
step_trim(),
step_trim_calibrated(),
step_trim_weights(),
step_unknown_eligibility()
Examples
# households subsampled for a follow-up module, selected with prob p2
df <- transform(sample_survey,
in_phase2 = as.integer(runif(nrow(sample_survey)) < 0.3),
p2 = 0.3)
weighting_spec(df, base_weights = pw) |>
step_subsample(selected = in_phase2, prob = p2, psu = "household_id")
#>
#> == Weighting specification (weightflow) ==
#> Data : 467 cases
#> Base wts: pw
#> Steps :
#> 1. phase-2 subsample [subsample_1]
#> Status : not estimated
#>
