Documentation

8.17 Simulation from the compiled model

Simulation reuses the compiled model and subject event engine. It draws ETAs from OMEGA, draws one EPS vector per observation from SIGMA, then evaluates the same record timeline with ICALL=4 when the calling workflow requests NONMEM-style simulation behavior.

Random effects are drawn using a robust covariance factor. Subject streams are derived from the master seed, label and subject ID, allowing parallel subject execution without making results depend on thread scheduling.

Shared consumers

The simulation layer supports predictive checks, study simulation, generated examples, parametric bootstrap and power workflows. Sharing event semantics reduces the risk that fitting and simulation interpret lags or infusions differently, but each caller can still choose inputs, parameters, seeds, residual-error mode and captured variables.

EpsMode has three paths:

  • derivatives at EPS zero for likelihood evaluation;
  • EPS zero without derivatives;
  • supplied EPS values for simulation.

Captured $TABLE-style variables can be returned alongside Y for simulation outputs.

Important limit

Dataset simulation rejects models using F_FLAG, all-likelihood or M2LL records. A likelihood value such as an M3 censoring probability is not a generative observation model. Simulate the underlying continuous value and apply censoring as a separate data process instead.

Parameter source

Simulation can use initial or final parameter states depending on the command and settings. Reproducibility requires recording THETA, OMEGA, SIGMA, any uncertainty draws, model code, seed, subject construction and BLQ/data-processing policy.

Common mistakes

  • Treating an F_FLAG=1 likelihood as a simulated DV.
  • Recording only the seed while changing subject IDs or thread-stream labels.
  • Assuming all commands select the same parameter source by default.

Checklist

  • Confirm parameter source and ICALL path.
  • Preserve seed and subject identities.
  • Separate latent-value simulation from censoring/BLQ processing.

Further reading

See likelihood records, event semantics and Chapter 28's planned sims documentation.