Why integration accuracy matters in a likelihood
In an ODE-based pharmacometric model, predicted concentrations or amounts are obtained by solving differential equations. A likelihood calculation then compares those predictions with observations. If the numerical solution changes with solver settings, the likelihood can change too. An optimizer may respond to that change by moving parameters, even when the underlying scientific model and data have not changed.
Integration error is therefore a possible source of unstable likelihoods, gradients and estimates. It is distinct from residual error: residual error represents variation described by the observation model, whereas integration error is introduced while numerically approximating the model-predicted state. Making the observation-error model more flexible does not, by itself, correct an inaccurate ODE solution.
The basic diagnostic question is not simply whether a solver reports success. It is whether reasonable changes in solver settings or numerical method leave the quantities relevant to inference effectively unchanged. Those quantities include the state trajectory, observation predictions, objective-function values, gradients and parameter estimates.
Likelihoods computed from numerical predictions
Suppose, for illustration, that observations \(y_i\) at times \(t_i\) have independent Gaussian errors with known standard deviation \(\sigma\), and the model prediction is \(m_i(\theta)=g(x(t_i;\theta),\theta)\). The log likelihood, up to any terms that do not depend on \(\theta\), is
In computation, the exact state is generally unavailable, so the solver supplies \(\tilde{m}_i(\theta)=g(\tilde{x}(t_i;\theta),\theta)\). The calculated likelihood is then an approximation to the likelihood defined by the continuous model. A small state error does not automatically imply a negligible likelihood error: the effect depends on the observation scale, the residuals and how sensitive the predictions are to the parameters.
The usual numerical interpretation assumes that the ODE has a well-defined solution over the interval of interest and that the chosen solver approximates that solution adequately at the parameters being evaluated. For comparisons across parameters, the solver must also behave consistently enough that the computed objective represents the same model throughout the optimization. Solver tolerances are numerical controls, not statistical assumptions and not substitutes for a scientifically justified observation-error model.
Worked Example: A Likelihood With Two Euler Fits
Consider the hypothetical decay model \(dA/dt=-kA\), \(A(0)=1\), with one observation \(y=0.80\) at time \(t=1\). Let the observation error be Gaussian with known \(\sigma=0.02\). The exact prediction is \(m(k)=e^{-k}\), so the log likelihood is maximized when the prediction equals 0.80. Thus the exact-model maximum-likelihood estimate is \(k=-\log(0.80)=0.22314\) per time unit.
Now approximate the ODE with \(N=10\) forward Euler steps, each of width \(1/10\). Repeated application of the update gives
If we restrict \(k\) to \(0\leq k<10\), every Euler multiplier is positive, so the computed state remains nonnegative. On this branch, the endpoint prediction decreases from 1 toward 0 as \(k\) increases. Setting the prediction equal to the observed value gives
per time unit. This is the likelihood maximum on the stated branch, because it makes the Gaussian residual zero.
The restriction matters. Without it, the equation \((1-k/10)^{10}=0.80\) has two real solutions: \(1-k/10\) can equal either \(0.80^{1/10}\) or \(-0.80^{1/10}\). The second solution is
per time unit. It is also positive and gives the same endpoint prediction and likelihood. But its Euler multiplier is negative, so intermediate states alternate in sign. That trajectory is not a plausible approximation to this nonnegative decay process. An endpoint likelihood alone does not guarantee a physically meaningful numerical trajectory.
Why small trajectory errors can alter gradients
Optimization uses changes in the computed objective to decide which direction to move parameters. If the numerical prediction has an error that varies with \(\theta\), its derivative contributes to the computed likelihood gradient. Near a well-fitting parameter, even a small prediction error can matter because the true likelihood gradient may be close to zero.
For the single-observation Gaussian model above, the score, or derivative of the log likelihood with respect to \(k\), is
This follows by differentiating \(-\{y-m(k)\}^2/(2\sigma^2)\) with respect to \(k\). In a numerical calculation, both the residual and the prediction derivative may differ from their continuous-model values. Consequently, a solver can produce a small-looking discrepancy in concentration while still noticeably perturbing the score when \(\sigma\) is small.
Worked Example: Integration Error Perturbs a Score
Use the same hypothetical observation \(y=0.80\), \(\sigma=0.02\), and \(N=10\) Euler steps. Evaluate the numerical prediction at the exact-model estimate \(k=0.22314\) per time unit. It is approximately
The numerical residual is \(0.80-0.79799=0.00201\). Differentiating the Euler prediction gives
The resulting numerical score is approximately
per unit of \(k\). By contrast, at \(k=-\log(0.80)\) the exact-model prediction equals the observation, so the exact score is zero. The discrepancy does not mean the observed data changed; it shows that the numerical approximation has changed the objective’s local behavior. A gradient-based optimizer could respond by moving away from the exact-model optimum.
Check refinement, not just solver status
A solver’s successful return indicates that it completed according to its numerical rules. It does not establish that the solution is accurate enough for a particular likelihood or parameter estimate. A practical check is to tighten tolerances, refine the numerical resolution where appropriate, or compare a second suitable solver, then inspect quantities at identical parameter values as well as after refitting.
For adaptive solvers, relative tolerance controls error relative to state magnitude, while absolute tolerance provides a scale for error when a state is small. Their effects depend on the units and magnitudes of the states. A tolerance appropriate for a large state may be inadequate for a small one. Set numerical controls with state scaling in mind, and verify the result empirically by refinement rather than assuming a chosen tolerance guarantees inferential accuracy.
Worked Example: Parameter Estimates Under Step Refinement
For the same hypothetical decay observation, use forward Euler with \(N\) equal steps over one time unit and restrict \(0\leq k<N\), so the Euler multiplier is nonnegative. On this branch, setting the prediction to 0.80 gives
For example, at \(N=5\), \(0.80^{1/5}\approx0.956353\), so \(\hat{k}_{\mathrm{Euler},5}=5(1-0.956353)\approx0.21824\) per time unit. At \(N=20\), \(0.80^{1/20}\approx0.988905\), giving \(\hat{k}_{\mathrm{Euler},20}\approx0.22190\) per time unit.
| Euler steps \(N\) | Estimate \(k\) (per time unit) |
|---|---|
| 5 | 0.21824 |
| 10 | 0.22067 |
| 20 | 0.22190 |
| Exact continuous model | 0.22314 |
The estimates move toward the continuous-model value as the step size decreases in this example. This calculation is a controlled illustration, not a guarantee that every solver or model converges monotonically. In an actual analysis, compare the fitted estimates, predictions and objective values under progressively tighter settings, and examine whether the changes are small relative to the precision needed for the scientific conclusions.
Why refinement works in this example
The direction of the Euler bias above can be justified directly. For \(0<k<N\), take logarithms of the Euler prediction:
All terms after \(-k\) are negative on this branch. Therefore the Euler endpoint is less than \(e^{-k}\) for \(k>0\). To match a fixed endpoint \(y=0.80\), the Euler fit must use a smaller \(k\) than the exact estimate in this example. Also,
This limit explains the convergence shown in the table. The argument applies to this decay equation and the nonnegative Euler branch; it should not be treated as a general claim about the direction of error for other models or numerical methods.
Diagnostics, alternatives and limitations
A useful numerical audit separates changes in the forward solution from changes caused by refitting. First evaluate the model at a fixed parameter vector under more than one suitably accurate numerical setting. Compare state trajectories at observation times and, where relevant, between observations. Then compare predicted observations, the likelihood or objective components, and gradients. Finally refit under the refined settings and compare estimates, uncertainty summaries and scientific conclusions.
Warning signs include trajectories that change visibly under refinement, large changes in predictions relative to the observation-error scale, likelihood or gradient changes that affect optimizer decisions, and fitted parameters that move materially as tolerances tighten. Inspect intermediate states as well as endpoints: the even-step Euler example shows how an implausible trajectory can return to a plausible endpoint. Save solver settings and report the refinement checks so that the numerical calculation can be reproduced.
There are several complementary ways to check an ODE likelihood:
- Use an analytic solution when available. It provides a direct reference for numerical predictions and can reveal error even when the numerical solver reports success.
- Refine a suitable numerical solver. Tighten tolerances or reduce step sizes and check convergence of the quantities used for inference.
- Compare an independent numerical method. Agreement between methods with different numerical behavior strengthens a diagnosis, although agreement alone is not proof of accuracy.
These checks have limits. Tighter tolerances increase computational cost and do not guarantee accuracy if the model is poorly scaled or the solver is being used outside its effective range. An independent method can share a common error. A close match in predictions at observation times may conceal differences in the trajectory between them. Moreover, if estimates remain unstable after integration has been shown to be adequate, other sources of instability should be investigated rather than continuing to tighten tolerances without a diagnostic purpose.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- In an ODE-based observation model, how does integration error differ from residual error?
- For the Euler endpoint \((1-k/N)^N\) with even \(N\), why can the equation \((1-k/N)^N=0.80\) have two real solutions? What additional restriction selects the nonnegative-state branch?
- For the hypothetical decay example, calculate the exact-model estimate \(k\) from \(y=0.80\) at \(t=1\).
- Name two quantities, beyond solver completion status, that should be compared during a refinement check.
Solutions. (1) Integration error is the difference between the numerical and exact ODE state; residual error is the observation variation represented by the statistical observation model. (2) An even power has the same value for positive and negative bases: \(1-k/N=\pm0.80^{1/N}\). Restricting \(0\leq k\leq N\) makes the Euler multiplier nonnegative and selects \(k=N(1-0.80^{1/N})\). (3) The exact prediction is \(e^{-k}\), so \(k=-\log(0.80)=0.22314\) per time unit. (4) Examples include state trajectories, predicted observations, objective values, gradients and refitted parameter estimates.