Learn R Programming

nonprobsampling (version 0.1.0)

reconstruct_sc_output: Reconstruct the sample data frame with fitted pseudo-weights

Description

Inserts the fitted pseudo-weights `w_fit` back into the original sample data frame `sc0`, using the NA handling strategy used during estimation. For `"omit"`, only the rows that were kept are returned. For `"exclude"`, all original rows are returned with NA weights for rows that were dropped. For `"fail"` or `"pass"`, all rows are assumed to be present and weights are attached directly.

Usage

reconstruct_sc_output(sc0, w_fit, keep_sc, na_mode, na_action_obj, sc_wname)

Value

A data frame derived from `sc0` with a pseudo-weight column named `sc_wname`.

Arguments

sc0

The original sample data frame (before any NA removal).

w_fit

Numeric vector of fitted pseudo-weights, one per kept row.

keep_sc

Logical vector identifying which rows of `sc0` were retained for fitting.

na_mode

Character string; one of `"omit"`, `"exclude"`, `"fail"`, or `"pass"`.

na_action_obj

The `na.action` attribute produced during NA removal, or NULL.

sc_wname

Name of the column in which pseudo-weights will be stored.