Skip to main content

Per-subject drawn parameters of a simulation

Description

Returns the parameters each simulated subject was drawn with - its random effects, its individual parameters and its [derived] / [output] values - from the result of [ferx_simulate](ferx_simulate.qmd) or [ferx_simulate_with_uncertainty](ferx_simulate_with_uncertainty.qmd). The table travels with the simulation as attr(sim, "parameters"); this accessor reads it and refuses an object that does not carry one.

Usage

ferx_sim_parameters(sim)

Arguments

  • sim: The data frame returned by [ferx_simulate](ferx_simulate.qmd) or [ferx_simulate_with_uncertainty](ferx_simulate_with_uncertainty.qmd).

Details

The table has one row per simulated subject and replicate, not per observation, so it is not added to the observation rows. Join it back on DRAW, SIM and ID: merge(sim, ferx_sim_parameters(sim), by = c("DRAW", "SIM", "ID")).

c(“## First-row values (FIRSTONLY) andvalue is the subject’s value at its first observation row -covariates and TIME there, and the occasion of that row - theof NONMEM’s $TABLE ... FIRSTONLY. For most models that issubject’s value at every row. It is not when a parameter reads a-varying covariate, depends on TIME, or carries inter-occasion: then the value differs between the subject’s rows and the tableonly the first one. attr(params, \"varying\") names every-parameter and [derived] / [output] column whosechanged across the observation rows of at least one simulated subject(a character vector, empty when none did), and printing the table repeatslist, so a first-row snapshot is not read as a constant.subject with no continuous (Gaussian) observation - only a time-to-event orendpoint - reports its individual parameters at its baselineand TIME = 0, and NA for every [derived] /[output] column.”, “## list("varying")value is the subject’s value at its first observation row -covariates and TIME there, and the occasion of that row - theof NONMEM’s $TABLE ... FIRSTONLY. For most models that issubject’s value at every row. It is not when a parameter reads a-varying covariate, depends on TIME, or carries inter-occasion: then the value differs between the subject’s rows and the tableonly the first one. attr(params, \"varying\") names every-parameter and [derived] / [output] column whosechanged across the observation rows of at least one simulated subject(a character vector, empty when none did), and printing the table repeatslist, so a first-row snapshot is not read as a constant.subject with no continuous (Gaussian) observation - only a time-to-event orendpoint - reports its individual parameters at its baselineand TIME = 0, and NA for every [derived] /[output] column.” )## Seealso

Other simulation: [ferx_calc_npde](ferx_calc_npde.qmd), [ferx_contrast_vpc](ferx_contrast_vpc.qmd), [ferx_predict](ferx_predict.qmd), [ferx_predict_survival](ferx_predict_survival.qmd), [ferx_simulate](ferx_simulate.qmd), [ferx_simulate_adaptive](ferx_simulate_adaptive.qmd), [ferx_simulate_with_uncertainty](ferx_simulate_with_uncertainty.qmd), [ferx_vpc_tte](ferx_vpc_tte.qmd)

Concept

simulation

Value

A data frame of class ferx_sim_parameters, one row per (DRAW, SIM, ID), in the order the observation rows produced them, with these columns:

  • DRAW, SIM, ID: The keys, spelled and typed as in the simulation’s own rows. DRAW is always 1 for ferx_simulate().
  • MIXNUM: Only for a [mixture] model: the 1-based class the subject was simulated under, as in the observation rows.
  • eta columns: One per between-subject random effect, named as the model declares it (e.g. ETA_CL): the drawn value.
  • kappa columns: Only for a model with kappa (IOV): one <kappa>_<k> column per kappa and occasion k (e.g. KAPPA_CL_1, KAPPA_CL_2), the kappa drawn for the subject’s k-th occasion, counting from 1 in the order the subject’s occasions occur; NA past a subject’s last occasion.
  • individual parameters: One column per [individual_parameters] entry, in declaration order (e.g. CL, V, KA).
  • derived columns: One per [derived] / [output] column, computed with the simulated random effects, IPRED and DV.

Attribute varying: see the section above.

Examples

ex <- ferx_example("warfarin")
sim <- ferx_simulate(ex$model, ex$data, n_sim = 2L, seed = 1L)
params <- ferx_sim_parameters(sim)
head(params)
attr(params, "varying")