Tutorials › Stochastic Differential Equations in Pharmacokinetics › A Worked Convergence Study for PK SDE Schemes

Discretization Schemes · Tutorial 55 of 100

A Worked Convergence Study for PK SDE Schemes

Learn how to design a coupled grid-refinement experiment for a pharmacokinetic SDE, estimate strong and weak errors, and interpret observed convergence rates cautiously.

Intermediate 13 min read

What You'll Learn

  • Construct coarse Brownian increments by summing fine-grid increments so path errors are meaningfully paired.
  • Estimate strong root-mean-square error and weak bias against a fine-grid reference.
  • Calculate observed rates from errors at successively halved step sizes.
  • Distinguish finite-reference and Monte Carlo errors from discretization error.
  • Interpret Euler–Maruyama convergence for a smooth additive-noise PK model.
  • Diagnose misleading rates caused by sampling noise, grid choice, or negative simulated concentrations.

Why Refine the Simulation Step?

A numerical path can look plausible without being accurate. To assess discretization, simulate the same stochastic inputs on progressively finer grids and compare the resulting quantities. The comparison must be designed carefully: for a strong error, coarse and fine paths need to represent the same Brownian trajectory. A weak error, by contrast, compares expectations of a quantity of interest and does not require path-by-path closeness.

This study uses the one-compartment concentration model \(dC_t=k(\theta-C_t)\,dt+\sigma\,dW_t\), with \(C_0\) fixed, \(k>0\), and constant \(\theta\) and \(\sigma\). It is a convenient test case because its exact endpoint distribution and mean are known. It is not a claim that every PK SDE has additive noise or that every concentration simulation should use this model.

Definition: At time \(T\), let \(C_T\) be the exact SDE state and \(C_T^{(h)}\) a numerical approximation with step size \(h\). For a square-integrable state, the strong root-mean-square error is \(\{E[|C_T^{(h)}-C_T|^2]\}^{1/2}\). For a measurable quantity \(g\) with finite expectations, the weak error is \(E[g(C_T^{(h)})]-E[g(C_T)]\); its magnitude is the absolute weak error. A method has strong order \(p\) or weak order \(q\) if the corresponding error is \(O(h^p)\) or \(O(h^q)\), respectively, as \(h\) decreases under the stated model assumptions.

In applications the exact state is often unavailable. A fine-grid approximation \(C_T^{(\delta)}\) then acts as a reference, and comparisons estimate errors relative to that reference—not automatically errors relative to the exact SDE. Assume a fixed terminal time \(T\), grids that divide \(T\), and a common, correctly coupled Brownian path for every grid being compared.

Coupling the Grids and Estimating Error

Choose a finest increment size \(\delta\). For each replicate, generate independent Brownian increments of variance \(\delta\) on that grid. A coarser increment is the sum of all fine increments spanning its interval. This preserves the Brownian distribution and makes the coarse and fine paths use the same driving noise.

Worked Example: Building Nested Brownian Grids

Take \(T=1\) and fine spacing \(\delta=1/256\). There are 256 fine increments per replicate. To compare \(h=1/128,1/64,1/32,1/16,\) and \(1/8\), sum groups of \(2,4,8,16,\) and \(32\) consecutive fine increments, respectively. For instance, if the first two fine increments are \(\Delta W_1\) and \(\Delta W_2\), the first \(1/128\)-grid increment is \(\Delta W_1+\Delta W_2\). Its variance is \(2/256=1/128\), as required.

Use the same 256 fine increments to form every grid for that replicate, and use independent fine paths for different replicates. Simulating unrelated Brownian paths at each step size would still permit a comparison of expectations, but it would add unnecessary path-to-path variation to a strong-error comparison.

For \(M\) independent coupled replicates, write \(C_{T,i}^{(h)}\) for the coarse endpoint and \(C_{T,i}^{(\delta)}\) for the reference endpoint on replicate \(i\). The natural estimates are \(\widehat E_{\mathrm{strong}}(h)=\{M^{-1}\sum_{i=1}^M(C_{T,i}^{(h)}-C_{T,i}^{(\delta)})^2\}^{1/2}\) and \(\widehat E_{\mathrm{weak}}(h)=|M^{-1}\sum_{i=1}^M[g(C_{T,i}^{(h)})-g(C_{T,i}^{(\delta)})]|\). The second estimates the magnitude of a paired difference in expectations; it is not the average absolute path difference.

Result: If the replicate-level differences \(D_i=C_{T,i}^{(h)}-C_{T,i}^{(\delta)}\) are independent and identically distributed with finite second moment, then \(M^{-1}\sum_iD_i^2\) converges almost surely to \(E[D_1^2]\) as \(M\) increases. Its nonnegative square root therefore converges almost surely to \(\{E[D_1^2]\}^{1/2}\). For weak comparisons, if the paired differences in \(g\) have finite first moment, their sample average converges almost surely to their expected difference; taking its absolute value estimates the absolute difference. These statements follow from the strong law of large numbers and continuity of the square-root and absolute-value functions. They concern the chosen finite reference grid; they do not remove its discretization bias. \(\square\)

Worked Example: Calculating a Paired Strong-Error Estimate

Suppose four coupled replicate runs give the following coarse-minus-reference endpoint differences, in concentration units, at one step size: \(0.12,-0.08,0.05,-0.15\). The squared differences are \(0.0144,0.0064,0.0025,\) and \(0.0225\). Their mean is \((0.0144+0.0064+0.0025+0.0225)/4=0.01145\), so the estimated strong RMS error is \(\sqrt{0.01145}\approx0.1070\).

At a finer step, suppose the paired differences are \(0.08,-0.05,0.03,-0.10\). The mean squared difference is \((0.0064+0.0025+0.0009+0.0100)/4=0.00495\), and the RMS estimate is \(\sqrt{0.00495}\approx0.0704\). The ratio is \(0.1070/0.0704\approx1.52\), corresponding to an observed rate \(\log_2(1.52)\approx0.60\) for this small illustrative run. Four replicates cannot establish an asymptotic rate; the calculation demonstrates the estimator, not a conclusion about the method.

A Model with an Exact Weak-Error Benchmark

Set \(k=0.5\), \(\theta=0.6\), \(C_0=2\), \(\sigma=0.2\), and \(T=1\). The exact mean follows by solving the mean equation \(m'(t)=k(\theta-m(t))\), \(m(0)=C_0\): \(E[C_1]=0.6+1.4e^{-0.5}\approx1.449143\). Euler–Maruyama gives \(C_{j+1}=C_j+kh(\theta-C_j)+\sigma\Delta W_j\). Taking expectations, and using \(E[\Delta W_j]=0\), yields \(E[C_T^{(h)}]=0.6+1.4(1-0.5h)^{1/h}\) when \(1/h\) is an integer.

Worked Example: Weak Error and Observed Rates

Choose \(g(c)=c\). The weak error is the difference between numerical and exact means. For \(h=1/4\), the Euler multiplier is \((1-0.5/4)^4=0.875^4=0.586181640625\), so the numerical mean is \(0.6+1.4(0.586181640625)=1.420654296875\). The absolute error is \(1.4491429236-1.4206542969\approx0.0284886\).

For \(h=1/8\), \(0.9375^8\approx0.5967191706\), giving mean \(1.4354068388\) and absolute error approximately \(0.0137361\). For \(h=1/16\), \(0.96875^{16}\approx0.601710355\), giving mean \(1.442394497\) and absolute error approximately \(0.00674843\).

For successive halvings, define the observed rate by \(r_h=\log_2(e(h)/e(h/2))\), where \(e(h)\) is the error being assessed. The first rate is \(\log_2(0.0284886/0.0137361)\approx1.052\); the second is \(\log_2(0.0137361/0.00674843)\approx1.025\). These values are consistent with a first-order weak error, though a short sequence of errors is not proof of an asymptotic rate.

What Rate Should This Model Show?

For the smooth additive-noise model above, Euler–Maruyama has strong order one at a fixed terminal time under the stated assumptions \(k>0\), constant \(\theta,\sigma\), and finite \(T\). The usual generic strong-order-\(1/2\) guarantee for Euler–Maruyama is valid in broader settings, but it is not the expected asymptotic rate for this particular model. The reason is that its diffusion coefficient is constant: Euler–Maruyama captures the Brownian increment exactly, and the remaining within-step noise effect enters through the smooth drift.

Derivation: Put \(Y_t=C_t-\theta\), so \(dY_t=-kY_t\,dt+\sigma\,dW_t\). Over one step, the exact solution is \(Y_{j+1}=e^{-kh}Y_j+\sigma\int_{t_j}^{t_{j+1}}e^{-k(t_{j+1}-s)}\,dW_s\); Euler–Maruyama gives \(Y_{j+1}^{(h)}=(1-kh)Y_j^{(h)}+\sigma\Delta W_j\). Their local difference, when started from the same value, is \([e^{-kh}-(1-kh)]Y_j+\sigma\int_{t_j}^{t_{j+1}}(e^{-k(t_{j+1}-s)}-1)\,dW_s\).

For \(kh\leq1\), Taylor's theorem gives \(|e^{-kh}-(1-kh)|\leq K h^2\) for a constant \(K\) independent of \(h\). By Itô isometry, the variance of the stochastic local difference is at most \(\sigma^2\int_0^h k^2u^2\,du=\sigma^2k^2h^3/3\), since \(|e^{-ku}-1|\leq ku\). Thus the local drift discrepancy is \(O(h^2)\) in RMS for bounded second moments, and the local noise discrepancy is \(O(h^{3/2})\) in RMS. Across \(T/h\) steps, the noise discrepancies are centered and independent of the past, so their accumulated squared contribution is \(O((T/h)h^3)=O(h^2)\). The drift discrepancies accumulate in mean square at order \(O(h)\) in RMS: each is \(O(h^2)\) and there are \(T/h\) steps, with bounded moments and stable factors \(1-kh\). Consequently the endpoint RMS error is \(O(h)\). This establishes the strong order for this linear additive-noise case; it is not a proof for arbitrary drift or diffusion coefficients. \(\square

The weak mean calculation is a useful independent check. Expanding \(\log(1-kh)=-kh+O(h^2)\) gives \((1-kh)^{T/h}=e^{-kT}(1+O(h))\), so the mean error is \(O(h)\). When simulations yield a strong rate near \(1/2\) in this model, do not immediately label that its asymptotic order: the generic guarantee is only a lower-order result here, and finite samples, reference-grid error, or an insufficiently fine range can obscure the model's order.

Diagnostics, Alternatives, and Limitations

A convergence table should include step size, replicate count, error estimate, and the rate computed from adjacent step sizes. A convincing rate is reasonably stable over several refinements, after transient coarse-grid behavior, and larger than the variation attributable to Monte Carlo error. For weak estimates, report the signed paired mean difference as well as its absolute value: cancellation can make the signed bias small even when replicate-level differences are variable. A standard error for the paired mean is the sample standard deviation of paired differences divided by \(\sqrt M\). The RMS strong estimate also has sampling variability; a bootstrap over independent paired replicates is one practical way to assess it.

The main alternative to a fine-grid reference is an exact solution or exact transition simulation, when available. That removes reference discretization error but may not be available for a nonlinear PK SDE. A fine-grid reference is broadly useful, but may be expensive and remains approximate. Independently simulated grids are adequate for comparing weak expectations in principle, but usually less efficient for paired comparisons because they discard the variance reduction from shared noise. In the convergence study, keep the Brownian coupling, terminal time, model parameters, and estimator fixed as \(h\) changes.

A rate can mislead if the finest reference is too coarse: both the reference and coarse approximations may share bias, or the reference error may dominate the difference. Check this by refining the reference itself and repeating the comparison. Also inspect path distributions, endpoint summaries, and the frequency and magnitude of negative concentrations. A positive-looking average does not rule out implausible individual paths; conversely, negative Euler–Maruyama values may be a model or scheme limitation rather than a convergence-rate calculation error. Do not silently truncate negative values, since truncation changes the numerical method and can alter both strong and weak errors.

Common pitfall: Computing the mean of \(|C_{T,i}^{(h)}-C_{T,i}^{(\delta)}|\) and calling it a weak error is incorrect. That quantity measures an average absolute paired path difference. The weak error for \(g\) is the absolute value of the average signed difference \(g(C_{T,i}^{(h)})-g(C_{T,i}^{(\delta)})\), because expectations can cancel positive and negative differences. Use the RMS of paired state differences for strong error and the signed paired average for weak bias.

A numerical convergence study measures the behavior of a scheme for a specified SDE; it does not establish that the SDE is an adequate pharmacokinetic model, that the simulated concentrations are clinically plausible, or that estimated parameters are reliable. It should be reported as a numerical diagnostic with its coupling, reference resolution, replicate count, and uncertainty made explicit.

Check Your Understanding

Answer each question, then compare with the brief solutions.

  1. On a fine grid with spacing \(\delta\), how should you construct an increment on a grid with spacing \(4\delta\)?
  2. Four paired weak differences are \(0.3,-0.1,0.2,-0.2\). What is their signed mean and the estimated absolute weak error?
  3. An error falls from \(0.08\) to \(0.02\) when \(h\) is halved. What observed rate does this imply?
  4. Why might a strong-order estimate near \(1/2\) fail to reveal the asymptotic order for the additive-noise model in this tutorial?

Solutions. (1) Sum four consecutive fine Brownian increments; the resulting variance is \(4\delta\). (2) The signed mean is \((0.3-0.1+0.2-0.2)/4=0.05\), so the estimated absolute weak error is \(0.05\). (3) \(r=\log_2(0.08/0.02)=\log_2(4)=2\). (4) Finite replicate variation, an overly coarse reference, or step sizes outside the asymptotic regime can distort observed rates; this model's smooth additive-noise structure has strong order one even though a generic Euler–Maruyama guarantee is order \(1/2\).

Clinical Biostats