Apply prediction correction
Details
The bin-median predbin is computed over the full pred_var
vector passed in. Callers must group their data by a binning variable
(e.g. nominal time, optionally stratified by compartment or covariates)
before invoking var_predcorr() so that predbin is the median across
the bin's observations, not the entire dataset.
See also
Other vectorized helpers:
var_addn(),
var_dosenorm()
Examples
pkmodel <- model_mread_load(model = "pkmodel")
#> Loading model from cache.
data <- df_mrgsim_addpred(
data = dplyr::filter(data_sad, CMT != 3),
model = pkmodel)
data <- data |>
dplyr::filter(EVID == 0) |>
dplyr::group_by(NTIME) |>
dplyr::mutate(PCDV = var_predcorr(ODV, PRED)) |>
dplyr::ungroup()
