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 --simulateThis will:
- Parse the model and
[simulation]block. - Generate simulated data from the model’s default parameters and random effects.
- Fit the model to the simulated data.
- Report parameter estimates and diagnostics.
What happens under the hood
For each subject:
- Random effects are sampled: \(\eta_i \sim N(0, \Omega)\).
- Individual parameters are computed using the
[individual_parameters]equations. - Predictions are generated using the structural model.
- Residual error is added: \(DV = IPRED + \epsilon\), with \(\epsilon \sim N(0, V)\).
- Observations below
0.001are clipped to0.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
- Simulation — ferx-core book — full reference
- Simulation (R-side workflow) — running simulations from a fitted model via ferx-r