Tutorials › Nonlinear Mixed-Effects Models (NLME) › Stable Numerical Estimation of Full TMDD ODEs

Target-Mediated Drug Disposition in NLME · Tutorial 361 of 797

Stable Numerical Estimation of Full TMDD ODEs

Learn to configure and check numerical integration and parameter gradients when estimating stiff full TMDD models with discontinuous dosing.

Advanced 12 min read

What You'll Learn

  • Recognize sources of stiffness in the full TMDD state equations.
  • Choose and assess relative and absolute solver tolerances.
  • Propagate parameter sensitivities through the ODE system.
  • Handle bolus doses and infusion changes as explicit events.
  • Check whether numerical gradients are reliable enough for likelihood optimization.
  • Distinguish solver error from optimizer or model-fitting problems.

Why Numerical Stability Matters in Full TMDD Estimation

A full target-mediated drug disposition (TMDD) model can contain processes that evolve on very different time scales. Binding may be rapid, while target turnover and drug elimination are slower. An integration method that takes steps suitable for the slow dynamics can miss the rapid ones; a likelihood optimizer can then respond to numerical error as if it were information about the parameters. The result may be unstable estimates, unreliable gradients, or apparent optimizer convergence at a parameter value that changes when solver settings change.

The task here is not to choose between a full TMDD model and a reduced model. It is to make the numerical solution of the full system, and the likelihood calculations based on it, sufficiently accurate and reproducible. The essential checks are to control integration error, represent dose events correctly, and verify that parameter derivatives remain stable at the accuracy used for fitting.

Full TMDD Equations and the Source of Stiffness

For clarity, write \(C(t)\) for free drug concentration, \(R(t)\) for free target concentration, and \(B(t)\) for drug–target complex concentration. Assume these states use compatible concentration units. Let \(u(t)\) be drug input expressed as amount per time, \(V\) the volume, \(k_e=CL/V\) the first-order elimination rate for free drug, \(k_{\mathrm{on}}\) and \(k_{\mathrm{off}}\) the binding and dissociation rate constants, \(k_{\mathrm{syn}}\) and \(k_{\mathrm{deg}}\) the target synthesis and degradation rates, and \(k_{\mathrm{int}}\) the complex internalization rate. Under mass-action kinetics, the equations are

$$ \begin{aligned} \frac{dC}{dt} &= \frac{u(t)}{V}-k_eC-k_{\mathrm{on}}CR+k_{\mathrm{off}}B,\\ \frac{dR}{dt} &= k_{\mathrm{syn}}-k_{\mathrm{deg}}R-k_{\mathrm{on}}CR+k_{\mathrm{off}}B,\\ \frac{dB}{dt} &= k_{\mathrm{on}}CR-(k_{\mathrm{off}}+k_{\mathrm{int}})B. \end{aligned} $$

These equations presume the stated reaction scheme and parameterization, nonnegative initial states, and a correctly specified input function. In the absence of drug and complex, the target equilibrium is \(R_0=k_{\mathrm{syn}}/k_{\mathrm{deg}}\). The dynamics can be stiff when, for example, binding and dissociation rates are much faster than target turnover. Stiffness is a numerical property: it means that stable integration may require small steps even where the solution itself changes slowly. It does not, by itself, mean the model is wrong.

An explicit solver is often effective for nonstiff systems, but can require prohibitively small steps on a stiff one. Implicit solvers, such as BDF or Radau methods, are common choices for stiff systems. Solver choice is not a substitute for checking accuracy: even a suitable stiff solver can return inadequate results if tolerances are too loose, state scales are poorly handled, or dosing events are represented incorrectly.

Tolerances, Sensitivities, and the Likelihood

An adaptive solver estimates local integration error and adjusts its step size to keep that error within a tolerance. A common control uses a scale such as \(\mathrm{atol}_i+\mathrm{rtol}|x_i|\) for state \(x_i\): \(\mathrm{rtol}\) sets relative accuracy, while \(\mathrm{atol}_i\) provides an absolute scale when a state is near zero. In a TMDD system, concentrations of \(C\), \(R\), and \(B\) may differ substantially, so a single absolute tolerance may be inappropriate. Use state-specific absolute tolerances when needed, with units and magnitudes chosen to resolve scientifically relevant changes in each state.

The solver's local error control does not guarantee that the final likelihood or its gradient is accurate enough for estimation. Small integration errors may accumulate or affect predictions at observation times. Therefore, check stability of predicted concentrations and the objective function as tolerances are tightened. The appropriate tolerance is one for which the quantities used in fitting are stable to a level that is negligible relative to the data's measurement error and the precision required for the estimates.

Definition: A parameter sensitivity \(S_j(t)=\partial x(t)/\partial q_j\) is the derivative of the state vector \(x(t)=(C(t),R(t),B(t))^\mathsf{T}\) with respect to a parameter coordinate \(q_j\). If \(q_j=\log(\theta_j)\), the coordinate is dimensionless and \(\partial x/\partial q_j=\theta_j\,\partial x/\partial\theta_j\).

For a differentiable ODE \(dx/dt=f(x,q,t)\), differentiating both sides with respect to \(q_j\) gives the sensitivity equation

$$ \frac{dS_j}{dt} = \frac{\partial f}{\partial x}S_j + \frac{\partial f}{\partial q_j}. $$

This follows from the chain rule: the parameter affects the derivative both through the current state \(x\) and directly through \(f\). For the full TMDD equations, the state Jacobian is

$$ \frac{\partial f}{\partial x} = \begin{pmatrix} -k_e-k_{\mathrm{on}}R & -k_{\mathrm{on}}C & k_{\mathrm{off}}\\ -k_{\mathrm{on}}R & -k_{\mathrm{deg}}-k_{\mathrm{on}}C & k_{\mathrm{off}}\\ k_{\mathrm{on}}R & k_{\mathrm{on}}C & -(k_{\mathrm{off}}+k_{\mathrm{int}}) \end{pmatrix}. $$

For example, if \(q_j=\log(k_{\mathrm{on}})\), the direct derivative \(\partial f/\partial q_j\) is \((-k_{\mathrm{on}}CR,-k_{\mathrm{on}}CR,k_{\mathrm{on}}CR)^\mathsf{T}\). Sensitivities also need initial values: if an initial state depends on a parameter, differentiate that initial condition as well. For instance, if \(R(0)=k_{\mathrm{syn}}/k_{\mathrm{deg}}\), its sensitivity to either target-turnover parameter is generally not zero.

At each observation time, state sensitivities pass through the observation model by the chain rule. They can then contribute to derivatives of the likelihood. Sensitivity equations are one way to obtain gradients; finite differences estimate a gradient by perturbing parameters and rerunning the ODE solver. Automatic differentiation is another option when it correctly differentiates the numerical solution and event handling. Each approach still depends on accurate state solutions and correct treatment of inputs.

Worked Example: Checking Integration Tolerance Against Predictions

Suppose a hypothetical fitting data set has observations near 8 hours, and a fitted full TMDD model is integrated using a stiff solver. The table reports the predicted free drug concentration at 8 hours and the negative log-likelihood (NLL) for successively tighter tolerances. The solver settings and data are held fixed apart from the tolerances.

Relative toleranceAbsolute tolerancePredicted \(C(8)\) (mg/L)NLL
\(10^{-3}\)\(10^{-6}\)1.284128.43
\(10^{-5}\)\(10^{-8}\)1.271126.91
\(10^{-7}\)\(10^{-10}\)1.270126.88
\(10^{-9}\)\(10^{-12}\)1.270126.88

From the second to the third setting, the prediction changes by \(1.271-1.270=0.001\) mg/L, and the NLL changes by \(126.91-126.88=0.03\). Tightening further leaves both displayed results unchanged. For this hypothetical calculation, the last two settings therefore support numerical stability to the reported precision. The first setting is not adequate for this fit: its prediction differs by \(0.014\) mg/L from the stable value and its NLL differs by \(1.55\). A reliable check also examines other states and observation times, not just this one prediction.

Discontinuous Dosing Inputs and Event Handling

Dose records are inputs to the ODE, not ordinary smooth functions. A bolus dose at time \(t_d\) changes the drug state instantaneously; it does not cause an instantaneous change in free target or complex under the model above. For a dose amount \(D\), the drug concentration jump is

$$ C(t_d^+)=C(t_d^-)+\frac{D}{V},\qquad R(t_d^+)=R(t_d^-),\qquad B(t_d^+)=B(t_d^-). $$

A constant-rate infusion that starts or stops changes \(u(t)\) discontinuously, but the states remain continuous at the switch unless the record also includes a bolus. Integrate up to each event, apply the appropriate jump if there is one, and restart integration with the new input. Allowing a solver step to span an unrepresented input change can smear the dose across time and corrupt predictions and gradients.

Worked Example: Handling a Bolus and an Infusion Stop

Consider a hypothetical model with \(V=2\) L. An infusion of \(4\) μmol/h runs from time 0 up to, but not including, 2 h. A \(20\) μmol bolus is given at 12 h. The infusion contributes \(u(t)/V=4/2=2\) μmol/L/h to \(dC/dt\) while it runs. At 2 h, input switches to zero; \(C\), \(R\), and \(B\) remain continuous there, but their derivatives can change because \(u(t)\) changes.

At 12 h, the bolus concentration increment is

$$ \frac{D}{V}=\frac{20\ \mathrm{\mu mol}}{2\ \mathrm{L}}=10\ \mathrm{\mu mol/L}. $$

If the integrated pre-dose value is hypothetically \(C(12^-)=0.80\) μmol/L, then the post-dose value is \(C(12^+)=0.80+10=10.80\) μmol/L. The target and complex values are unchanged at the instant of dosing. Numerically, integrate separately over the intervals ending at 2 h and 12 h, switch off the infusion at the first event, and apply the concentration jump at the second. This preserves both the timing and size of the input.

Gradient Checks and Common Failure Modes

A likelihood optimizer uses changes in the objective to decide how to update parameters. If a gradient is noisy because repeated ODE solutions have inconsistent numerical error, an optimizer may take unproductive steps, stop prematurely, or report convergence for the wrong reason. Parameter transformations help enforce constraints—for example, optimizing \(q=\log(k_{\mathrm{on}})\) keeps \(k_{\mathrm{on}}>0\)—but do not remove numerical error. Gradients should be checked at plausible parameter values and, when possible, near the reported solution.

Worked Example: Comparing a Sensitivity Gradient With a Finite Difference

For a hypothetical likelihood calculation, let \(q=\log(k_{\mathrm{on}})\). With tight solver tolerances, suppose the NLL at \(q-0.01\) is 12.438 and at \(q+0.01\) is 12.462. The centered finite-difference estimate is

$$ \frac{\mathrm{NLL}(q+0.01)-\mathrm{NLL}(q-0.01)}{2(0.01)} = \frac{12.462-12.438}{0.02} = 1.20. $$

Suppose the sensitivity-based gradient is 1.18. Their relative difference, using 1.18 as the comparison scale, is \(|1.20-1.18|/1.18=0.0169\), or about 1.69%. This is reasonable agreement for this hypothetical check, though acceptable agreement depends on the fitting precision needed. If loose tolerances instead give a finite-difference estimate of 0.74, the discrepancy is a warning: rerun with tighter tolerances, verify the event schedule and initial sensitivities, and repeat the comparison before trusting the optimizer's gradient.

Common warning signs include predictions that change materially under tighter tolerances, a large number of rejected solver steps, negative concentrations beyond negligible rounding error, abrupt jumps at times without a dose, and gradients that change substantially with small changes in finite-difference step size. These signs call for investigation, not automatic parameter adjustment. Check state scales and absolute tolerances, event times and units, solver suitability, parameter transformations, and the derivative calculation. A negative state can also reflect an unsuitable model or parameter region; clipping it to zero without justification changes the equations and can introduce a nondifferentiable operation.

A practical comparison is to fit or evaluate the same objective with a stiff solver at progressively tighter tolerances, then compare the predictions, objective values, and gradients. A nonstiff explicit method may provide a useful independent check if it can solve the problem accurately, but failure or excessive computation with that method is not evidence that the model is invalid. Likewise, finite-difference gradients are useful checks but can be sensitive to both perturbation size and solver error. Sensitivity equations are often efficient when many likelihood evaluations are needed, but require correct derivative equations and initial sensitivities.

Common mistake: Treating optimizer convergence as proof that the fitted parameters are numerically reliable. Convergence only indicates that the optimizer met its stopping rule for the computed objective and gradient. The correction is to verify that predictions, likelihood, and gradients are stable under tighter integration tolerances and correct event handling.

Numerical stability is necessary but not sufficient for sound inference. Stable integration cannot resolve structural non-identifiability, inadequate data, or misspecification of the observation model. Conversely, unstable estimates that move as tolerances change should not be interpreted biologically until numerical accuracy is addressed. The appropriate standard is not a particular solver setting in isolation, but reproducibility of the quantities used for estimation at a precision adequate for the analysis.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. Why can a TMDD system with rapid binding and slow target turnover require a stiff solver?
  2. A bolus of 15 μmol is given into a model with \(V=3\) L. What is the instantaneous change in \(C\), and which states remain unchanged at the dose instant?
  3. What does it suggest if predicted concentrations are stable as tolerances tighten but the estimated likelihood gradient is not?
  4. Why should an infusion start or stop be represented as an integration event?

Solutions. (1) The fast and slow processes occur on very different time scales; a stable integration method may need small steps to resolve the fast dynamics even when the solution changes slowly. (2) The change is \(15/3=5\) μmol/L. Under the stated model, \(R\) and \(B\) remain unchanged instantaneously. (3) The gradient calculation may be inaccurate even if the displayed predictions are stable; check sensitivity equations, finite-difference step size, event handling, and tolerances used for perturbed parameter evaluations. (4) The input rate changes discontinuously. Segmenting the integration at the switch ensures the solver uses the correct input on each interval rather than averaging across the change.