12.9 $SUBROUTINES, $MODEL and required PK: SUB01–SUB07
SUB01 validates ADVAN/TRANS. SUB02 requires TOL for general ADVANs 6, 8, 9, 13, 14 and 15. SUB03 requires $MODEL for general ADVAN and $DES for ODE ADVAN. SUB04 checks required PK parameter assignments; SUB05 warns about observation-compartment scale.
SUB06 validates compartment indices of Fn, ALAGn, Rn, Dn, Sn and A(n). SUB07 requires one DADT(n) per modeled compartment and no out-of-range derivative.
Parameter names depend on TRANS
ADVAN3/4 with clearance-volume TRANS differs from a micro-rate parameterization. A variable called CL is not sufficient if the selected TRANS requires another mapping. Compare the explicit support matrix and model intent.
TOL correction
Default tol inserts configured TOL=9 when required. Tolerance influences numerical integration and performance. Treat insertion as a proposed solver setting, then perform tolerance sensitivity testing; passing SUB02 does not establish accuracy.
Compartment-by-compartment review
Draw a small compartment map and assign each compartment its number, name, dose/observation role, and scale. Then map every F1, ALAG1, R1, D1, S1, and A(1)-style reference to that table. For an ODE model, add the corresponding DADT(n) equation and verify no modeled state is omitted. This visual exercise catches errors that remain syntactically legal after compartments are inserted or reordered. Finally, compare the map with dataset CMT values and the requested observation compartment.
A SUB pass confirms recognizable structural conventions, not the differential equations' scientific validity, units, initial conditions, or numerical stability.
Common mistakes
- Changing ADVAN/TRANS to match available variable names without scientific review.
- Accepting inserted TOL as validated.
- Using S1/S2 without confirming observed compartment and units.
- Forgetting DADT for a compartment added to
$MODEL.
Checklist
- Match ADVAN, TRANS and required PK variables.
- Reconcile compartment indices and defaults.
- Review scale expressions and units.
- Validate TOL/solver sensitivity.
Further reading
See ADVAN/TRANS matrix, parameter mappings/scaling and ODE tolerances.