Documentation

8.8 Analytic and matrix-exponential propagation

Linear compartment systems have the form

\[ \frac{dA}{dt}=MA+r, \]

where M is the rate matrix and r is an optional constant infusion-rate vector for the interval. For zero-order input held constant between events,

\[ A(t+\Delta)=e^{M\Delta}A(t)+\int_0^\Delta e^{Ms}r\,ds. \]

nlmx constructs M from TRANS micro rates or general-linear rate variables. Classic one-, two- and three-compartment mammillary systems carry analytic eigen rates. The propagator can use their spectral structure and falls back to a matrix exponential when rates coincide or the general structure requires it.

Why event segmentation matters

The linear solution is exact for a constant system over an interval. $PK is evaluated at records, and doses, lagged inputs, infusion ends and model events split intervals. A time-varying parameter is therefore piecewise constant according to record/event semantics, not continuously interpolated unless expressed in $DES.

Infusion input is integrated with the same propagator rather than approximated as small boluses. Constant-infusion equilibrium solves the linear steady-state system when it is nonsingular.

Degenerate rates

When KA approaches an elimination eigenvalue, textbook coefficient formulas can suffer cancellation. Matrix-exponential fallback avoids division by a nearly zero eigenvalue difference. Validation should include coincident or nearly coincident rates rather than only well-separated examples.

Differentiation

The rate matrix and interval can contain dual numbers. Derivatives propagate through the analytic/matrix operations, including event times that depend on ETA through lag, duration or rate. This is a key distinction from applying finite differences around the entire subject simulation.

Common mistakes

  • Calling a linear solution exact while ignoring event-order differences.
  • Testing only well-separated rate constants.
  • Approximating infusions as bolus sequences in a reference calculation.

Checklist

  • Compare the constructed rate matrix element by element.
  • Test bolus, infusion and coincident-rate cases.
  • Include parameter- and event-time derivative checks.

Further reading

See general linear models, automatic differentiation and event timelines.