Learn R Programming

nonprobsampling (version 0.1.0)

finalize_pw_fit: Finalize and assemble the `pw_fit` return object

Description

Attaches the reconstructed sample data frame, the pseudo-weight vector, and NA-handling metadata to `result`, then assigns the `"pw_fit"` class so that downstream S3 methods can dispatch on it.

Usage

finalize_pw_fit(result, sc_out, sc0, sc_wname, na_mode, keep_sc, na_action_obj)

Value

`result` with `sc_updated`, `pseudo_weights`, and `internal` fields populated, and class set to `"pw_fit"`.

Arguments

result

A list accumulating outputs from the estimation pipeline.

sc_out

The reconstructed sample data frame produced by `reconstruct_sc_output()`.

sc0

The original (pre-NA-removal) sample data frame, stored for diagnostic access via `result$internal$raw_sc`.

sc_wname

Name of the pseudo-weight column in `sc_out`.

na_mode

Character string describing how NAs were handled; stored in `result$internal$na`.

keep_sc

Logical vector of retained rows; stored in `result$internal$na`.

na_action_obj

The `na.action` attribute from NA removal; stored in `result$internal$na`.