Tutorials › Stochastic Differential Equations in Pharmacokinetics › Forecasting Concentrations from Filtered PK States

Kalman Filter and Extended Kalman Filter · Tutorial 67 of 100

Forecasting Concentrations from Filtered PK States

Propagate filtered state means and covariances to future PK concentrations, and construct prediction intervals with the assumptions and approximation limits made explicit.

Advanced 11 min read

What You'll Learn

  • Propagate a Gaussian filtered state through a linear PK transition over one or several forecast steps.
  • Calculate concentration means and prediction variances from linear observation equations.
  • Distinguish uncertainty in latent concentrations from uncertainty in future assay measurements.
  • Construct conditional prediction intervals and state when their coverage is exact or approximate.
  • Apply local linearization to nonlinear PK transitions and concentration mappings.
  • Diagnose horizon-dependent variance, linearization error, and implausible intervals.

From a filtered state to a concentration forecast

A Kalman filter summarizes information through the current observation time \(t\) by a filtered state estimate and its uncertainty. Forecasting asks a different question: given that summary and a specified future dose or input, what concentrations are plausible at a later time? The answer requires propagating both the state mean and its covariance, then mapping the forecast state to the concentration of interest.

Write \(\mathcal Y_t\) for all observations available through time \(t\). Suppose the filtered state has conditional distribution \(X_t\mid\mathcal Y_t\sim N(m_{t|t},P_{t|t})\). A forecast is conditional on these observations and on the future inputs treated as known. In a linear Gaussian model, its mean and covariance are exact. With nonlinear dynamics or a nonlinear concentration mapping, a local linearization generally produces an approximation, not an exact distribution.

Definition: A forecast state distribution at time \(t+j\) is the conditional distribution of \(X_{t+j}\) given \(\mathcal Y_t\) and the specified future inputs. A concentration prediction interval is an interval intended to contain a future latent concentration, or a future measured concentration, with stated conditional probability. These are different targets when future assay noise is present.

Linear Gaussian propagation

Consider a state transition over one forecast step,

$$ X_{k+1}=A_kX_k+b_k+W_k,\qquad W_k\sim N(0,Q_k). $$

Here \(A_k\) maps the current state to the next state, \(b_k\) contains known inputs such as a specified dose contribution, and \(Q_k\) is the process-noise covariance. Assume that, conditional on information at time \(t\), future process noises are mutually independent, independent of \(X_t\), and Gaussian with the stated covariances. These assumptions make the propagated state distribution Gaussian.

Theorem: If \(X_k\mid\mathcal Y_t\sim N(m_{k|t},P_{k|t})\) and the transition above holds with independent Gaussian process noise, then
$$ m_{k+1|t}=A_km_{k|t}+b_k,\qquad P_{k+1|t}=A_kP_{k|t}A_k^{\mathsf T}+Q_k. $$

Proof. Conditional on \(\mathcal Y_t\), the state is Gaussian and independent of \(W_k\). An affine transformation of a Gaussian vector is Gaussian, and the sum of independent Gaussian vectors is Gaussian. Taking conditional expectations gives

$$ E[X_{k+1}\mid\mathcal Y_t] =A_kE[X_k\mid\mathcal Y_t]+b_k+E[W_k] =A_km_{k|t}+b_k. $$

For the covariance, the deterministic vector \(b_k\) contributes nothing, and independence makes the cross-covariance terms zero. Thus

$$ \operatorname{Var}(X_{k+1}\mid\mathcal Y_t) =A_kP_{k|t}A_k^{\mathsf T}+Q_k. $$

This gives the stated conditional Gaussian distribution and completes the proof. \(\square\)

For several steps, apply the recursion at each step using the transition and inputs appropriate to that interval. For a constant transition \(A\), zero input, and constant process covariance \(Q\), repeated substitution gives

$$ m_{t+j|t}=A^jm_{t|t},\qquad P_{t+j|t}=A^jP_{t|t}(A^j)^{\mathsf T} +\sum_{r=0}^{j-1}A^rQ(A^r)^{\mathsf T}. $$

The covariance expression follows by induction: it holds at \(j=1\) by the one-step result. If it holds at \(j\), then \(P_{t+j+1|t}=AP_{t+j|t}A^{\mathsf T}+Q\). Substituting the expression at \(j\) gives the initial-covariance term \(A^{j+1}P_{t|t}(A^{j+1})^{\mathsf T}\) and the sum with powers \(r=1,\ldots,j\), plus the new \(Q\) term for \(r=0\). This is the formula at \(j+1\). The mean formula follows by applying \(m_{k+1|t}=Am_{k|t}\) repeatedly. \(\square\)

Suppose the latent concentration is a linear function of the state, \(C_k=H_kX_k+d_k\), where \(H_k\) is a row vector for a scalar concentration and \(d_k\) is known. Its conditional mean and variance are

$$ \mu_{C,k|t}=H_km_{k|t}+d_k,\qquad s^2_{C,k|t}=H_kP_{k|t}H_k^{\mathsf T}. $$

If the future measurement is \(Y_k=C_k+V_k\), with independent \(V_k\sim N(0,R_k)\), its predictive variance is \(s^2_{C,k|t}+R_k\). Include \(R_k\) only when the target is a future assay result; it does not belong in the variance of the latent concentration itself.

Result: If the target concentration is conditionally Gaussian with mean \(\mu_C\) and positive standard deviation \(s_C\), the central interval
$$ \left[\mu_C-\Phi^{-1}(0.975)s_C,\ \mu_C+\Phi^{-1}(0.975)s_C\right] $$

has exactly 95% conditional coverage under that Gaussian model. Here \(\Phi\) is the standard normal distribution function. The commonly rounded multiplier 1.96 gives approximately 95% coverage, not exactly 95%.

Worked Example: One-Step Concentration Forecast

A filtered scalar amount state has \(m_{t|t}=2\) and \(P_{t|t}=0.25\). Over the next interval, \(X_{t+1}=0.8X_t+1+W_t\), where \(W_t\sim N(0,0.09)\). The known input is 1, and concentration is \(C_{t+1}=X_{t+1}/2\). Find its forecast distribution and a central 95% interval for latent concentration.

The state forecast mean is \(0.8(2)+1=2.6\). Its variance is \(0.8^2(0.25)+0.09=0.16+0.09=0.25\). Therefore \(C_{t+1}\) has mean \(2.6/2=1.3\) and variance \(0.25/2^2=0.0625\). Correction: the state variance calculation is \(0.8^2(0.25)=0.16\), so the total is \(0.25\); thus the concentration variance is \(0.25/4=0.0625\), and its standard deviation is \(0.25\).

Using the exact normal multiplier, the interval is \(1.3\pm1.959964(0.25)\). The margin is \(0.489991\), giving approximately \([0.8100,1.7900]\). This interval concerns the latent concentration. If an assay has independent error variance \(R=0.04\), the future measured concentration has variance \(0.0625+0.04=0.1025\), standard deviation approximately \(0.3202\), and a wider interval.

Forecasting over multiple steps

A multi-step forecast must include process noise from every intervening transition. For time-varying transitions, the one-step recursion is usually safest to implement: use the appropriate \(A_k,b_k,Q_k\) at each step, then compute concentration from the resulting state distribution at the requested horizon. The accumulated noise contribution is transformed by all later transitions, so it need not have the same size at the final time as when it first entered the state.

Worked Example: A Two-Step Forecast

Suppose the filtered scalar state has mean 10 and variance 1. For each of the next two steps, use \(X_{k+1}=0.9X_k+W_k\), with independent \(W_k\sim N(0,0.04)\). Concentration is \(C=X/5\). Calculate the two-step forecast and a central 95% interval.

The mean after two steps is \(0.9^2(10)=8.1\). The variance after the first step is \(0.9^2(1)+0.04=0.85\). After the second it is \(0.9^2(0.85)+0.04=0.6885+0.04=0.7285\). Equivalently, \(0.9^4(1)+0.9^2(0.04)+0.04=0.6561+0.0324+0.04=0.7285\).

Thus the concentration mean is \(8.1/5=1.62\), and its variance is \(0.7285/25=0.02914\). Its standard deviation is approximately \(0.1707\). The exact-multiplier interval is \(1.62\pm1.959964(0.1707)\), approximately \([1.2854,1.9546]\).

Local linearization for nonlinear PK models

For a nonlinear transition \(X_{k+1}=f_k(X_k)+W_k\), a common forecast approximation expands \(f_k\) to first order around the current forecast mean \(m_{k|t}\). Define \(A_k=Df_k(m_{k|t})\), the Jacobian matrix of first derivatives. The local approximation is \(f_k(X_k)\approx f_k(m_{k|t})+A_k(X_k-m_{k|t})\). It gives

$$ m_{k+1|t}\approx f_k(m_{k|t}),\qquad P_{k+1|t}\approx A_kP_{k|t}A_k^{\mathsf T}+Q_k. $$

A nonlinear concentration function \(h(X)\) can be handled similarly: set \(H=Dh(m)\), where \(m\) and \(P\) are the forecast state mean and covariance at the target time. Then \(E[h(X)]\approx h(m)\) and \(\operatorname{Var}(h(X))\approx HPH^{\mathsf T}\). These are first-order approximations; they are not generally exact moments or guarantees of Gaussian prediction-interval coverage. For nonlinear dynamics, re-evaluate the Jacobian at the current forecast mean at each step.

Worked Example: Local Linearization of a Nonlinear Transition

Let the current filtered state be approximately \(N(2,0.04)\), and suppose the next transition is \(f(x)=0.9x+0.02x^2\), with independent process variance \(Q=0.01\). Let concentration be \(C=X/2\). Use a first-order forecast.

The forecast mean is \(f(2)=0.9(2)+0.02(2^2)=1.8+0.08=1.88\). The derivative is \(f'(x)=0.9+0.04x\), so the local slope at 2 is \(0.98\). The approximate state variance is \(0.98^2(0.04)+0.01=0.9604(0.04)+0.01=0.038416+0.01=0.048416\).

The concentration mean is approximately \(1.88/2=0.94\), and its variance is \(0.048416/4=0.012104\), with standard deviation approximately \(0.1100\). The first-order central interval is \(0.94\pm1.959964(0.1100)\), or approximately \([0.7244,1.1556]\). This is an approximate interval because the nonlinear transition need not produce a Gaussian state. In this example, the curvature is \(f''(x)=0.04\); for a Gaussian input, its second-order contribution to the transition mean is \(\tfrac12 f''(2)(0.04)=0.0008\), a small but nonzero term omitted by the first-order forecast.

Diagnostics, alternatives, and limitations

Process noise adds uncertainty at each step, but total forecast variance need not increase monotonically with horizon. The transition can contract uncertainty. For example, if \(A=0.5\), \(P_{t|t}=100\), and \(Q=0.1\), then the next variance is \(0.5^2(100)+0.1=25.1\), which is less than 100. Always inspect the propagated covariance rather than assuming that longer horizons necessarily produce wider intervals.

Check that covariance matrices remain symmetric and positive semidefinite, and verify that dose inputs enter at the correct event times. For a scalar concentration, inspect the forecast mean, standard deviation, and interval against plausible concentration scales. A Gaussian interval may extend below zero even when concentration must be nonnegative; that signals a limitation of the Gaussian approximation, not a physical negative concentration. In a nonlinear forecast, large curvature over the range of state uncertainty, strongly asymmetric simulated predictions, or sensitivity to the linearization point are warnings that a local approximation may be poor.

The main alternatives answer related but different needs. A linear Gaussian forecast gives exact conditional moments and intervals under its assumptions. A local linear forecast is computationally efficient for nonlinear models but may miss curvature and skewness. Simulation from the filtered state followed by propagation through the specified nonlinear model can represent non-Gaussian concentration predictions more directly, at additional computational cost. Whichever method is used, state clearly whether the interval concerns latent concentration or a future observation, and which future inputs are conditioned on.

Common pitfall: “Process noise is added at every step, so forecast variance must rise with horizon.” The process-noise term is added, but the transition also transforms both existing and accumulated uncertainty. A contracting transition can reduce the total variance, as the scalar calculation above shows. Another frequent error is adding assay variance to a latent-concentration interval; include it only when forecasting the measured assay result.

Check Your Understanding

Answer each question, then compare with the worked solutions below.

  1. A scalar filtered state has mean 4 and variance 0.5. It transitions as \(X'=X+W\), with \(W\sim N(0,0.1)\). If \(C=X'/2\), find the concentration mean and variance.
  2. For a linear concentration mapping \(C=HX+d\), which forecast quantities determine its mean and variance?
  3. A forecast latent concentration has variance 0.16, and future assay error has independent variance 0.09. What is the predictive variance for the assay result?
  4. Why can a stable or contracting transition yield smaller forecast variance at a later horizon even when process noise is positive?
  5. What is the status of a Gaussian prediction interval obtained after first-order linearization of nonlinear dynamics?

Solutions. (1) The state mean is \(4\), and its variance is \(0.5+0.1=0.6\). Hence \(E[C]=4/2=2\) and \(\operatorname{Var}(C)=0.6/4=0.15\). (2) Its mean is \(Hm+d\), and its variance is \(HPH^{\mathsf T}\), using the forecast state mean \(m\) and covariance \(P\). (3) The assay-result variance is \(0.16+0.09=0.25\). (4) The transition multiplies existing covariance by its slope or matrix as well as adding process covariance; contraction can reduce the transformed existing uncertainty by more than the new noise increases it. (5) It is an approximation, not generally an exact Gaussian interval with guaranteed nominal coverage; nonlinear curvature and skewness can affect its accuracy.

Clinical Biostats