mrgsolveR/df_mrgsim_replicate.R
df_mrgsim_replicate.Rddf_mrgsim_replicate() is a wrapper function for mrgsolve::mrgsim_df()
that returns a data.frame containing replicates iterations of data
Input dataset. Must contain required variables for mrgsim_df() other than those handled by
other arguments.
mrgsolve model object.
Number of replicates. Either an integer, or something coercible to an integer.
Character name of the DV variable in data.
Names of actual and nominal time variables. Must be named character vector.
Defaults is: c(TIME="TIME", NTIME="NTIME").
Names of model outputs from model. Must be named character vector.
Defaults is: c(PRED= "PRED", IPRED = "IPRED", DV= "DV").
Numeric variables in data or simulation output to recover.
Must be a character vector of variable names from the simulation output to carry_out
and return in output. Defaults are "CMT", "EVID", "MDV", "NTIME".
Character variables in data or simulation output to recover.
Must be a character vector of variable names from the simulation output to recover
and return in output.
Name of replicate variable in data. Must be a string. Default is "SIM".
Random seed. Default is 123456789.
Additional arguments passed to mrgsolve::mrgsim_df().
A data.frame with data x replicates rows (unless obsonly=TRUE is passed to mrgsolve::mrgsim_df())
and the output variables in output_vars, num_vars, and char_vars.
model <- model_mread_load(model = "model")
#> Loading model from cache.
simout <- df_mrgsim_replicate(data = data_sad, model = model, replicates = 100,
dv_var = "ODV",
num_vars = c("CMT", "LLOQ", "EVID", "MDV", "WTBL", "FOOD"),
char_vars = c("USUBJID", "PART"),
irep_name = "SIM")