Why Integration Must Follow the Covariate Path
When a covariate changes over time, a parameter driven by that covariate can also change during the interval between observations. The amount of drug or response at the end of the interval therefore depends on the parameter’s path, not merely on its value at the beginning or end. In a nonlinear mixed-effects (NLME) model, this time-varying parameter enters the differential equation for each subject, alongside that subject’s random effects and evolving state variables.
The computational consequence is important: the differential equation solver must evaluate the covariate-dependent parameter as time advances. If the covariate or dose history has a discontinuity, the solver must also recognize the event time. Otherwise it can integrate across a jump as though the model were smooth, producing an incorrect state trajectory.
The covariate path may be observed directly or constructed from recorded measurements using a specified rule. That path is an input to the model; the solver does not infer unrecorded covariate values simply by integrating the PK/PD equations. Subject-level random effects are usually constant for a subject during the modeled interval, while \(z_i(t)\) and thus \(\psi_i(t)\) may vary with time.
From a Changing Parameter to a State Trajectory
The general equation \(dx_i(t)/dt=f(\cdot)\) is usually nonlinear and must be solved numerically. A useful special case makes the integration principle explicit. Suppose the amount \(A(t)\) in a one-compartment model is eliminated at a time-varying first-order rate \(k(t)\), with no input during the interval:
Because \(A(t)>0\), divide both sides by \(A(t)\), then integrate from zero to \(t\):
This derivation shows why evaluating \(k\) only at the endpoints is generally insufficient: the amount remaining depends on the accumulated elimination rate over the entire interval. It also gives a direct check on a numerical solution when \(k(t)\) has a tractable integral.
Worked Example: Integrating a Continuously Changing Elimination Rate
Consider hypothetical data for one subject, with \(A_0=100\) mg and a constant volume \(V=10\) L. Suppose a time-varying covariate produces \(k(t)=0.2\exp(0.1t)\) h\(^{-1}\), where \(t\) is in hours. Find the amount and concentration at \(t=2\) h.
The assumptions for this calculation are that the stated covariate path and rate function apply throughout 0 to 2 h, the subject has no dose or other input during that interval, and \(V\) remains constant. Integrate the rate:
Substitute into the analytic solution:
The predicted concentration is \(C(2)=A(2)/V\), so \(C(2)\approx64.2232/10=6.422\) mg/L. For comparison, a numerical integration with a coarser time grid might approximate the integrated rate as 0.4426; that approximation gives \(100e^{-0.4426}\approx64.24\) mg, close to but not identical to the analytic result. Tightening the solver tolerance or refining the grid should bring the numerical trajectory toward 64.22 mg.
Numerical Integration When the Equation Is Not Solvable in Closed Form
For a general PK/PD model, the solver advances the state from one time to the next while reevaluating the right-hand side. For example, a response equation may have a changing rate of response loss, \(k_{\mathrm{out}}(t)\), and a constant input \(k_{\mathrm{in}}\). Even this linear-in-state equation need not have a convenient closed-form solution for every covariate path; a nonlinear response function makes numerical integration still more common.
A standard explicit method is the fourth-order Runge–Kutta method. For \(dx/dt=f(t,x)\) and a step of length \(h\), it evaluates four slopes, using intermediate times and state values, then combines them:
The intermediate evaluations matter: if a covariate changes continuously, the parameter it drives should be evaluated at the intermediate times as well as at the start and end of the step. A solver that holds the parameter fixed for the whole step is using a different approximation.
Worked Example: A Response Equation with a Changing Covariate
Suppose, hypothetically, that a response \(R(t)\) follows \(dR/dt=2-k_{\mathrm{out}}(t)R\), with \(R(0)=5\). Let \(k_{\mathrm{out}}(t)=0.2[1+0.5z(t)]\) h\(^{-1}\), where \(z(t)=t\) over the interval 0 to 1 h. Use one Runge–Kutta step with \(h=1\) h to estimate \(R(1)\). Response is in arbitrary response units, so the input rate 2 has units of response units per hour.
Here \(k_{\mathrm{out}}(t)=0.2+0.1t\), which is positive throughout the interval, and the response and covariate paths are smooth. The slope is \(f(t,R)=2-(0.2+0.1t)R\). The four slopes are:
Thus
response units. If instead the rate were frozen at its initial value, \(k_{\mathrm{out}}=0.2\) h\(^{-1}\), the constant-rate solution would give \(R(1)=10+(5-10)e^{-0.2}\approx5.906\). That difference illustrates the consequence of ignoring the changing covariate; it is not evidence that either value is universally preferable. The model definition determines whether the rate should vary.
Integration at Dose and Covariate Events
A smooth covariate path permits ordinary integration across a step, subject to the solver’s accuracy controls. A bolus dose creates an instantaneous state change, and a discontinuous covariate can cause an instantaneous change in a parameter. These events require explicit treatment. The solver should integrate to the event time using the pre-event equations, apply the event rule, then restart using the post-event equations. The state need not jump when the covariate changes unless the model specifies a state jump; a bolus dose, by contrast, changes the drug amount.
Worked Example: Splitting Integration at a Dose and Covariate Change
Suppose, hypothetically, a subject starts with \(A(0)=100\) mg, has \(V=10\) L, and follows \(dA/dt=-kA\). The rate is 0.2 h\(^{-1}\) before \(t=1\) h and 0.4 h\(^{-1}\) after a covariate changes at that time. A 50 mg bolus is administered at exactly \(t=1\) h. Find the concentration at \(t=2\) h. Assume the dose is fully administered instantaneously and there are no other inputs.
First integrate to just before the event. Then apply the bolus jump, \(A(1^+)=A(1^-)+50\) mg, and use the new rate after the event:
The event time is both a dose time and a covariate-change time, so the integration interval is split there. Treating the bolus as a gradual input or applying the new elimination rate over the pre-event interval would not implement the stated model.
Practical Workflow, Diagnostics, and Alternatives
A reliable implementation makes the relationship between the covariate, parameter, state equation, and event schedule explicit. The following sequence helps prevent a mathematically correct solver from solving the wrong model:
Write \(\psi_i(t)=h(z_i(t),\theta,\eta_i)\), including units and any transformation used to keep a parameter in its allowable range.
State which parameter varies with the covariate and which states it affects; retain subject-specific random effects as defined by the model.
Provide the solver with dose times and any times at which the covariate path or governing equation has a discontinuity.
Refine the maximum step or tolerances, compare predictions, and check state and parameter behavior against model constraints.
Useful diagnostics include repeating the integration with tighter tolerances or a smaller maximum step and checking whether predicted states and the objective function remain stable. Compare a numerical result with an analytic solution when one is available, as in the elimination example. Inspect trajectories near event times, confirm that a bolus produces the specified jump, and verify that a parameter changes on the intended side of a covariate event. Implausible negative concentrations, abrupt response jumps without a specified mechanism, or strong dependence on solver settings can indicate an implementation or numerical problem.
A continuous covariate-driven parameter is the natural choice when the scientific model says the effect evolves continuously and a defensible continuous covariate path is available. A piecewise-constant approximation is an alternative: hold the covariate-dependent parameter fixed within intervals and update it at interval boundaries. This can simplify calculations, but its accuracy depends on interval width and on how rapidly the covariate changes. An analytic solution is preferable when available because it avoids numerical integration error, but many nonlinear coupled PK/PD systems do not have one. None of these computational approaches can repair a misspecified covariate path or an incorrect parameter relationship.
Common Mistake and Limitations
A frequent mistake is to compute a covariate-driven parameter once at the beginning of an observation interval and hold it fixed, even though the model defines that parameter as a function of the continuously changing covariate. The correction is to evaluate the function at the solver’s internal times, or to state explicitly that a piecewise-constant approximation is being used and assess its numerical adequacy. A related event-handling error is to let a solver step straddle a dose or abrupt covariate change without applying the event rule at the correct time.
Integration accuracy is not the same as scientific validity. A highly accurate solver can produce precise predictions from a poor covariate trajectory, an implausible functional form, or incomplete event records. Numerical stiffness, sharp but continuous changes, and tightly coupled state equations may also require more specialized solvers. Finally, estimation can be sensitive to integration error because small trajectory errors may affect the likelihood and its gradients; solver settings should therefore be checked at the parameter values relevant to estimation, not only for one convenient example.
Check Your Understanding
Answer each question, then compare with the brief solutions below.
- For \(dA/dt=-k(t)A\), explain why \(A(t)\) depends on the integral of \(k(s)\), rather than only on \(k(t)\).
- A solver uses a covariate-dependent parameter evaluated only at the start of every step. What modeling approximation is this making, and how would you check it?
- At a time when a covariate changes abruptly but no dose is given, must the amount \(A(t)\) jump? Explain.
- Why should integration be split at a bolus dose time?
Solutions. (1) Dividing the equation by \(A(t)\) and integrating gives \(A(t)=A_0\exp[-\int_0^t k(s)\,ds]\), so the accumulated rate determines the amount. (2) It is treating the parameter as piecewise constant within each solver step; refine the step size or compare with a solver that reevaluates the parameter along the path. (3) Not under the stated differential equation alone: the covariate may change the derivative, but the state remains continuous unless a separate jump rule is specified. (4) A bolus changes the amount instantaneously, so integration must first reach the event, apply the dose jump, and then continue from the updated state.