Generate a synthetic PMX dataset from a fitted model
Source:R/model-generate.R
synpmx_model_generate.RdDraws new subjects from the fingerprint of a synpmx_model_estimate() fit.
This stage reads no patient data: its arguments are the model and a subject
count, so everything about the source that reaches the output has already
passed through the fit. A full fit is reduced to its model_fingerprint()
first, so generation cannot read a diagnostic the fingerprint leaves behind.
Arguments
- fitted_model
A fingerprint from
model_fingerprint(), or thepmx_fitted_modelfromsynpmx_model_estimate()it was taken from.- n_subjects
Number of synthetic subjects. Defaults to the source count.
- seed
Generation seed.
Value
A data frame in the source's shape, carrying the fingerprint it was
generated from as its pmx_fitted_model attribute.
Details
Per subject: an arm is assigned keeping the source arm shares, covariates are drawn from the study-wide covariate model, random effects from the between-subject covariance matrix, and the dose schedule from the arm's dosing model. The concentration is then evaluated at the visits drawn from the arm's visit model, against the schedule that was drawn, so a reduced or skipped dose reaches the concentrations rather than appearing only in the dosing records. A PD-only fit skips concentration simulation: responses use their fitted study-time shapes or visit frequencies, while any declared dosing records are still generated.