Sets the weight of the units known to be outside the target population to zero,
so they leave the cascade and take no part in any later step or in
collect_weights(). Their weight is discarded, not redistributed: the weight
total is meant to fall by exactly the mass they carried. Use it once
eligibility has been resolved, immediately after step_unknown_eligibility().
Arguments
- spec
a weighting_spec.
- ineligible
a 0/1 dummy column (1 = ineligible) or any logical condition (unquoted) that is TRUE for out-of-scope units.
- reason
optional string naming why the units are out of scope (e.g.
"left the target population between waves"). Recorded for the report narrative; it makes the panel distinction between a between-wave exit of the universe (the longitudinal population shrank – weight 0, no reweighting) and ordinary ineligibility explicit. Does not change the computation.- 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
Apply it AFTER step_unknown_eligibility: ineligibles must be present and NOT flagged as unknown during that step, so they take part in the known-eligibility group and receive their share of the redistributed unknown weight. Their weight is then correctly discarded here (it represents the ineligible share of the unknown units, which are out of scope).
See also
Other weighting steps:
step_assert(),
step_calibrate(),
step_cre(),
step_model_calibration(),
step_nonresponse(),
step_nr_sensitivity(),
step_pseudoweight(),
step_rescale(),
step_round(),
step_select_within(),
step_subsample(),
step_trim(),
step_trim_calibrated(),
step_trim_weights(),
step_unknown_eligibility()
Examples
df <- transform(sample_survey,
ineligible = as.integer(region == "West" & age > 90))
weighting_spec(df, base_weights = pw) |>
step_drop_ineligible(ineligible = ineligible) |>
prep()
#>
#> == Weighting specification (weightflow) ==
#> Data : 467 cases
#> Base wts: pw
#> Steps :
#> 1. drop ineligible [drop_ineligible_1]
#> Status : estimated (prep)
#>
#> Stage summary:
#> stage n_active sum_wts cv_wts deff_kish n_eff
#> base 467 4371 0.236 1.056 442
#> stage_1_step_drop_ineligible 466 4364 0.236 1.055 442
#>
#> deff_kish = 1 + CV^2 (Kish design effect from unequal weighting);
#> n_eff = n_active / deff_kish. Both worsen with each adjustment and
#> improve with trimming.
#>
