Simulation

The optional [simulation] block defines a virtual clinical trial design for generating simulated data from the model. The block is consumed by the ferx-core CLI’s --simulate workflow.

Syntax

[simulation]
  subjects = N
  dose     = AMOUNT
  cmt      = COMPARTMENT
  seed     = SEED
  times    = [t1, t2, t3, ...]
Key Description
subjects Number of virtual subjects to simulate
dose Dose amount administered to each subject
cmt Dosing compartment (1-indexed)
seed Random seed for reproducible simulations
times Observation time points

Example

[simulation]
  subjects = 100
  dose     = 100
  cmt      = 1
  seed     = 12345
  times    = [0.5, 1, 2, 4, 8, 12, 24]

This simulates 100 subjects, each receiving a dose of 100 units into compartment 1, with observations at 0.5, 1, 2, 4, 8, 12, and 24 time units.

Running a simulation–estimation study

Run from the ferx-core CLI:

ferx model.ferx --simulate

This will:

  1. Parse the model and [simulation] block.
  2. Generate simulated data from the model’s default parameters and random effects.
  3. Fit the model to the simulated data.
  4. Report parameter estimates and diagnostics.

What happens under the hood

For each subject:

  1. Random effects are sampled: \(\eta_i \sim N(0, \Omega)\).
  2. Individual parameters are computed using the [individual_parameters] equations.
  3. Predictions are generated using the structural model.
  4. Residual error is added: \(DV = IPRED + \epsilon\), with \(\epsilon \sim N(0, V)\).
  5. Observations below 0.001 are clipped to 0.001.

Covariates

Covariates can be referenced in [individual_parameters] as usual. The simulated population currently uses default covariate values — covariates are not randomised by the simulation block itself.

See also