20.6 $DES and ODE models
nlmx supports $DES through ADVAN6/8/9/13/14/15. ADVAN13 can use Dormand–Prince, Rosenbrock and automatic stiff switching. ODE state is driven by event records and model-defined derivatives.
Solver tolerance becomes part of objective accuracy. Population finite differences call the model repeatedly; noisy integration can produce noisy gradients, line-search failures and unstable covariance. Use a tolerance convergence study: tighten solver settings until predictions, OFV and estimates stabilize within analysis criteria.
Stiff systems may need a stiff-capable solver rather than a tiny explicit step. Resets, infusions, lagged doses, MTIME/MPAST and modeled rates/durations must be tested at event boundaries.
ODE fits cost more per evaluation than analytic models. Benchmark only after numerical equivalence. A faster loose solver outside tolerance is not a valid acceleration.
ODE qualification strategy
Start with fixed effects and a single subject. Verify initial conditions, dose input, state units, output compartment and time origin. Add one feature at a time: infusion, repeated dose, covariate dependence, random effects and residual likelihood. Compare coarse and tighter solver settings when exposed; stable scientific conclusions should not depend materially on a numerically inadequate tolerance.
Discontinuities deserve explicit tests. Dose events, resets, piecewise covariates and conditional logic can change the right-hand side abruptly. Place evaluation times immediately before and after each event to confirm ordering. For stiff or nonlinear systems, test parameter extremes expected during optimization, not merely the initial values.
Performance claims for ODE models must report solver workload and accuracy. A faster fit caused by looser integration or failed trajectories is not equivalent. Record failed subjects/evaluations and ensure penalties do not create artificial optima. When possible, compare mass balance, limiting behavior and conserved quantities as additional correctness checks.
Common mistakes
Do not lower TOL solely for speed, compare analytic and ODE fits before fixed-prediction alignment, or ignore discontinuities at events. Successful integration does not guarantee derivative smoothness.
Checklist
- Select appropriate solver/stiffness behavior.
- Perform tolerance convergence study.
- Test event-boundary states.
- Align scaling/initial conditions.
- Report solver settings in validation/benchmark.
Further reading
See Chapter 9 numerical precision, event history, and performance.