df_pcdv
is a helper function to perform prediction-correction
of observed or simulated depedent variables.
df_pcdv(
data,
bin_var = "NTIME",
strat_vars = NULL,
output_vars = c(PRED = "PRED", IPRED = "IPRED", DV = "DV"),
lower_bound = 0
)
Input dataset
Exact binning variable. Default is "NTIME"
.
Stratifying variables. Default is "CMT"
.
Names of model outputs from model
. Must be named character vector.
Defaults are "PRED"
, "IPRED"
, and "DV"
. Currently both "IPRED"
and "DV"
are required in model@capture
.
Lower bound of the dependent variable for prediction correction. Default is 0
.
A data.frame containing one row per unique combination of
bin_var
and strat_vars
and new variable PCDV
containing
prediction-corrected observations.
model <- model_mread_load(model = "model")
#> Loading model from cache.
data <- df_addpred(data_sad, model)
simout <- df_pcdv(data, output_vars = c(DV = "ODV", PRED = "PRED"))