ODE Filters and Smoothers

Summary

An ODE filter models the solution and its first derivatives jointly by a Gauss–Markov process — the -times integrated Wiener process (IWP) prior — and conditions on the ODE by treating the residual as a (zero-valued) observation. This yields a nonlinear state-space model (SSM) solved by Bayesian filtering (prediction along the linear-Gaussian dynamics + a nonlinear update) and RTS smoothing. The standard Gaussian methods are the extended Kalman ODE filters/smoothers EKF0/EKF1 and EKS0/EKS1 (zeroth/first-order Taylor linearisation of ); a particle ODE filter captures the full non-Gaussian posterior. Recommended default: EKS1.

Overview

This is the central note of Part VI. It gives (1) the continuous- and discrete-time SSM that rigorously casts an IVP as filtering (Tronarp et al. 2019); (2) the IWP prior and its Taylor-extrapolation semantics; (3) the exact prediction step and the approximate EKF0/EKF1 update; (4) the RTS smoother pass; (5) iterated smoothers for MAP inference; (6) the particle filter for the true posterior; and (7) calibration, step-size control, and the choice of method. It heavily reuses Gauss-Markov Processes and SDEs (the prior) and Bayesian Filtering and Smoothing (the Kalman filter/RTS smoother).

Main Content

The state vector and continuous-time SSM

We model and jointly by a stochastic process (the “system”), whose state vector contains and its derivatives via fixed projection matrices:

with extracting the solution and extracting its derivative. For the standard choice modelling derivatives (), and , so .

Continuous-time dynamic model (Eqs. 38.4–38.6)

The prior is the law of a linear time-invariant SDE

where is a standard Wiener process, the drift and the diffusion matrix. From the SDE solution (see Gauss-Markov Processes and SDEs),

^def-ssm-cont Here is the transition (discretisation) matrix and the process-noise covariance.

Conditioning on the ODE: the observation process

Define the nonlinear map , , and the state misalignment (observation process)

Because solves the ODE iff , we have for all . Imposing this via the Dirac likelihood and observing the constant data conditions on all information in the IVP. In the continuous-data limit Picard–Lindelöf guarantees zero posterior uncertainty, — hinting at the favourable convergence of Theory of ODE Filters and Smoothers.

Discrete-time SSM (Tronarp et al. 2019)

On a grid with steps , writing , :

Nonlinear discrete SSM for ODEs (Eqs. 38.10–38.13)

^def-ssm-disc This resembles the linear-Gaussian SSM of Bayesian Filtering and Smoothing, except the measurement map is now nonlinear (and ). It is complete and rigorous, so any Bayesian filter/smoother applies. Note the data carry information through the likelihood: conditioning on imposes — the analogue of Eq. (37.7).

Choice of prior: the integrated Wiener process (IWP)

Modelling and its derivatives as coordinates, with , forces for , restricting the SDE to

The drift coefficients and scale parametrise the Matérn family (). Two named special cases:

  • -times integrated Wiener process (IWP): . The standard prior for generic ODEs because it extrapolates with Taylor polynomials of degree .
  • -times integrated Ornstein–Uhlenbeck process (IOUP): , only free (mean-reverting); can help exponentially decaying curves (e.g. radioactive decay).

IWP predictive mean = Taylor extrapolation (Eq. 38.14)

Under the -times IWP prior, the -th component of the predictive mean of the dynamic model is

i.e. a -th-order Taylor-polynomial extrapolation. In particular the solution state () is predicted by a -th-order Taylor expansion — the best local model absent further information (Taylor’s theorem), matching classical solvers’ forward extrapolation along .

Initialisation

If is known exactly, all derivatives at are determined by (recursive coefficients from Classical ODE Solvers as Regression), giving the exact initialisation

Krämer & Hennig (2020) compute this efficiently by Taylor-mode automatic differentiation (Bettencourt et al. 2019), with cost growing at most quadratically (not exponentially) in .

The algorithms (high level)

Bayesian ODE filtering (Algorithm 38.1)

procedure ODE FILTER(f, x0, p(x_{n+1}|x_n))
  initialise p(x0)                              // with available info about x(0)
  for n = 0 : N-1 do
    (optional) adapt dynamic model p(x_{n+1}|x_n)
    (optional) choose step size h_n > 0
    predict p(x_{n+1}|z_{1:n})   from p(x_n|z_{1:n})   // by (38.11)
    observe z_{n+1} = 0                                  // by (38.13)
    update  p(x_{n+1}|z_{1:n+1}) from p(x_{n+1}|z_{1:n})  // by (38.12)
  end for
  return {p(x_n|z_{1:n}); n=0,...,N}

An ODE smoother (Algorithm 38.2) wraps this: after the forward filter pass, iterate computing the smoothing marginals from by the RTS recursion (Eq. 38.26). A filter/smoother is named by prefixing “ODE” to its classical name.

The extended Kalman ODE filters EKF0/EKF1

The dynamic model is linear-Gaussian, so the prediction step is exact:

The update involves the nonlinear (via ); to stay Gaussian, linearise by a Taylor approximation around the predictive mean . The two standard choices give the approximate update step (data ):

EKF0/EKF1 update (Eqs. 38.18–38.22)

The difference between EKF0 and EKF1 is only the choice of :

  • EKF0: . Exact update after replacing by the constant (zeroth-order Taylor). Requires no Jacobian.
  • EKF1: , with the Jacobian of . Exact update after replacing by its linearisation (first-order Taylor).

These never leave the Gaussian family, hence Gaussian ODE filters. Default (recommended; a positive can absorb linearisation error). With , EKF0 reproduces classical solvers (Schober, Särkkä & Hennig 2019) — see Theory of ODE Filters and Smoothers §39.3.

The extended Kalman ODE smoothers EKS0/EKS1

Extend the filtering distributions to the full smoothing posterior by the backward RTS recursion (Eqs. 38.23–38.25):

EKS0/EKS1 use the EKF0/EKF1 filter (line 3 of Alg. 38.2) then this backward pass. The smoothing posterior can be interpolated off-grid via the dynamics (38.11), so it contains the same information as the full GP posterior.

EKF0/EKS0 generalise Bayesian quadrature

If the ODE is really an integral, , its solution is . Approximating this with the Kalman-filter version of Bayesian Quadrature (Algorithm 11.2) is equivalent to solving the ODE with the EKF0/EKS0 (Tronarp et al. 2019, Prop. 1).

Iterated smoothers for MAP inference (IEKF/IEKS)

Almost nothing can be said about the true non-Gaussian posterior the EKF/EKS approximate. As a compromise, the maximum a posteriori (MAP) estimate — the most likely sample trajectory — solves the global MAP problem

subject to , where is the Mahalanobis norm. The iterated extended Kalman smoother (IEKS) and its filter (IEKF) iterate the EKS1/EKF1 with re-linearisation of around the new estimate until a fixed point; the IEKS converges to a local minimum of this non-convex problem and is regarded as the best Gaussian approximation of the true posterior (see convergence rates in Theory of ODE Filters and Smoothers §39.1.1).

Particle ODE filters and smoothers

For the truly non-Gaussian posterior, use sequential Monte Carlo. Represent the filtering distribution by weighted samples . With a proposal distribution , draw and update weights by importance sampling (Eqs. 38.39–38.40):

Sequential importance sampling + resampling defines the particle ODE filter, which approximates the true nonparametric posterior with Monte-Carlo rate . It can capture bifurcations (Fig. 38.2, Bernoulli ODE). The bootstrap filter sets ; closer proposals use a Gaussian filter.

Calibration, error estimation, step-size selection (§38.5)

  • Global calibration: the posterior covariance scales linearly with the prior scale . The quasi-ML estimator (Tronarp et al. 2019) for EKF0/EKF1 is

with the innovation covariance at — nearly free, since it reuses the EKF likelihood approximations.

  • Local calibration: (Eq. 38.42), capturing the added uncertainty of step .
  • Local error estimate: (with calibrated ), a cheap probabilistic replacement for classical error estimates (which compare two solvers, e.g. Dormand–Prince/ode45).
  • Step-size control: proportional control, , with tolerance , safety factor , and local rate (Theorem 39.2).

Which filter/smoother to choose? (§38.6)

Recommendation

Short answer: EKS1. Gaussian filters/smoothers are far faster and more stable than particle filters. Among Gaussian ones, first-order (EKF1/EKS1) use the Jacobian of (automatic differentiation), giving a more precise mean and better-calibrated uncertainty. Smoothing exploits the full data over while keeping cost. Alternatives: EKF1 (skip smoothing pass — cheaper, good if only final-time matters); EKS0 (no Jacobian — cheaper constant, good for stiff ODEs when rough uncertainty suffices); EKF0 (both simplifications); IEKS (best for the MAP estimate); particle ODE filter (only when non-Gaussian structure, e.g. bifurcations, is crucial — then it is really an alternative to perturbative solvers). Efficient implementations: ProbNum package.

Examples

First EKF0 step, 2-times IWP (Fig. 38.1)

With a 2-times IWP prior (, modelling ) initialised exactly at : the prediction extrapolates forward along the dynamic (Taylor) model; samples show diverging possibilities for . The update conditions on , collapsing the samples to those with the correct first derivative at and reducing uncertainty. The dashed 95% band contracts after conditioning on . Repeating over produces the solution with calibrated error bars.

Bifurcation capture (Fig. 38.2)

The Bernoulli ODE , , bifurcates at and concentrates at attractors . With uncertain initial value , the true pushforward is bimodal at . A bootstrap particle ODE filter (30 particles, 2-times IWP, ) nicely captures both branches; a Gaussian ODE filter would only track the middle solution and miss the bifurcation entirely.

Connections

See Also