8.9 General linear models with ADVAN5 and ADVAN7
ADVAN5 and ADVAN7 obtain compartment topology from $MODEL and transition/elimination rates assigned in $PK. The implementation discovers names such as K12, K10 and K1T2.
K12 means transfer from compartment 1 to 2. K10 means elimination from compartment 1. K1T2 is an explicit from-to spelling. A destination of zero or n+1 is treated as elimination from the modelled system.
For every rate, nlmx subtracts the rate from the source diagonal of M and adds it to the destination row/source column when the destination is a model compartment. Rates must be nonnegative at runtime.
$MODEL responsibilities
The $MODEL record supplies compartment names and flags. DEFDOSE chooses the default dosing compartment; DEFOBS chooses the default observation compartment. If neither flag is supplied, the first compartment is used for that role. Explicit CMT values in data can override defaults record by record.
At least one recognised rate constant must be assigned. A sophisticated $PK block that computes rates under different aliases will not be inferred unless the final assigned names match the recognised pattern.
ADVAN5 versus ADVAN7
Both are represented as general linear systems by the current engine. The important reproducibility inputs are topology, rate assignments, compartment defaults, scale variables and events. Do not infer a numerical distinction merely from the ADVAN number without checking implementation and source-program expectations.
Validation fixture design
Construct tiny systems with one active transfer at a time. Verify mass balance, direction, elimination and scale. Then combine transfers and compare the matrix exponential to an independent solver. Include invalid names and negative rates as expected failures.
Common mistakes
- Reversing source and destination in
Kmn. - Forgetting elimination in the source diagonal.
- Using an unrecognised alias for a computed rate.
Checklist
- Draw the
$MODELgraph and deriveM. - Confirm
DEFDOSE,DEFOBSandCMTbehavior. - Test mass balance and negative-rate rejection.
Further reading
See matrix propagation, compartment mapping and accuracy review.