The ROUKF

Intro

A Kalman filter is a recursive estimator: it corrects its estimate one measurement at a time. For a dynamical model, it propagates the state and its covariance with the model, and corrects both whenever a measurement is available.

For a linear model, it solves the estimation problem of Problem formulation exactly. The unscented Kalman filter is a popular extension to nonlinear models: it represents the uncertainty by \(N_\sigma\) deterministically chosen sigma points, propagates them through the model, and recovers the mean and covariance from them. For a joint estimate of state and parameters, \(N_\sigma\) grows with the dimension of both, which is infeasible for large models. The ROUKF restricts the uncertainty to the \(p\)-dimensional parameter space, so that \(N_\sigma\) grows with \(p\) only.

We write \(\bs{\hat\chi}^k_\mp\) and \(\bs{\hat\theta}^k_\mp\) for the a priori (predicted by the model) and a posteriori (corrected by the measurements) estimates at the assimilation step \(k\), and \(\bs{Y}_{(*)}\) for the matrix collecting the vectors \(\bs{Y}_{(1)}, \dots, \bs{Y}_{(N_\sigma)}\) column-wise.

Sigma points

The sigma points perturb the estimates along the stencil \(\bs{I}_{(1)}, \dots, \bs{I}_{(N_\sigma)} \in \mathbb{R}^p\), with equal weights \(\alpha = 1/N_\sigma\), the weighted mean \(E_\alpha(\bs{Y}_{(*)}) = \alpha \sum_i \bs{Y}_{(i)}\) and

\[\bs{P}_\alpha = \alpha \, \bs{I}_{(*)} \bs{I}_{(*)}^T.\]

estimation.sigma_points selects the stencil (kipe.roukf.sigma_point_stencil()):

  • canonical: \(N_\sigma = 2p\), a pair along each parameter, \(\bs{I}_{(i)} = \sqrt{p}\, \bs{e}_i\) and \(\bs{I}_{(p+i)} = -\sqrt{p}\, \bs{e}_i\), as in [NAB26];

  • simplex: \(N_\sigma = p + 1\), the vertices of a regular simplex [MC11];

  • unique: \(N_\sigma = 1\), \(\bs{I}_{(1)} = \bs{0}\), without spread and so without correction: a check of the setup.

Both canonical and simplex have zero mean and \(\bs{P}_\alpha = \bs{1}\). A symmetric stencil with \(2p + 1\) points and equal weights would have \(\bs{P}_\alpha = \frac{2p}{2p+1} \bs{1}\), and represent too small a spread.

The algorithm

The filter starts from \(\bs{\hat\chi}^0_+ = \bs{\chi}^0\) and \(\bs{\hat\theta}^0_+ = \bs{\theta}^0\), with

\[\bs{L}_\theta^0 = \sqrt{\bs{P}_\theta^0}, \qquad \bs{L}_\chi^0 = \bs{0} \in \mathbb{R}^{r \times p}, \qquad \bs{U}^0 = \bs{P}_\alpha,\]

\(\sqrt{\bs{P}_\theta^0}\) the Cholesky factor of \(\bs{P}_\theta^0\). Each assimilation step \(k = 1, \dots, N_T\) consists of four stages.

Sampling. The sigma points perturb the current estimates along the stencil, for \(i = 1, \dots, N_\sigma\),

\[\bs{\hat\chi}^{k-1}_{(i)} = \bs{\hat\chi}^{k-1}_+ + \bs{L}_\chi^{k-1} \bs{C}^{k-1} \bs{I}_{(i)}, \qquad \bs{\hat\theta}^{k-1}_{(i)} = \bs{\hat\theta}^{k-1}_+ + \bs{L}_\theta^{k-1} \bs{C}^{k-1} \bs{I}_{(i)},\]

with \(\bs{C}^{k-1}\) the lower Cholesky factor of \((\bs{U}^{k-1})^{-1}\), so that the sigma points have the covariance \(\bs{L}_\theta \bs{U}^{-1} \bs{L}_\theta^T\) (kipe.roukf.sample()).

Note

Some publications, e.g., [Ber12] and [NB22], write \((\bs{C}^{k-1})^T\) here, with \(\bs{C}^{k-1}\) a Cholesky factor of \((\bs{U}^{k-1})^{-1}\). That holds for the upper factor, \(\bs{C}^T \bs{C} = \bs{U}^{-1}\), as, e.g., MATLAB’s chol returns it. With the lower factor, \(\bs{C} \bs{C}^T = \bs{U}^{-1}\), as numpy’s cholesky returns it and kipe uses, it is \(\bs{C}^{k-1}\): with its transpose, the sigma points have the intended covariance only while \(\bs{U}^{-1}\) is diagonal, i.e., in the first step, since \(\bs{U}^0 = \bs{P}_\alpha = \bs{1}\).

Prediction. Each sigma point is propagated with the model, the parameters stay constant,

\[\bs{\hat\chi}^k_{(i)} = \mathcal{A}^k\big(\bs{\hat\chi}^{k-1}_{(i)}, \bs{\phi}(\bs{\hat\theta}^{k-1}_{(i)})\big), \qquad \bs{\hat\theta}^k_{(i)} = \bs{\hat\theta}^{k-1}_{(i)},\]

and their means are the a priori estimates

\[\bs{\hat\chi}^k_- = E_\alpha\big(\bs{\hat\chi}^k_{(*)}\big), \qquad \bs{\hat\theta}^k_- = E_\alpha\big(\bs{\hat\theta}^k_{(*)}\big).\]

Innovation. For each sigma point, the discrepancy between the measurements and their prediction,

\[\bs{\Gamma}^k_{(i)} = \bs{Z}^k - \mathcal{H}\big(\bs{\hat\chi}^k_{(i)}\big).\]

Correction. The sensitivities

\[\bs{L}_\chi^k = \alpha \, \bs{\hat\chi}^k_{(*)} \bs{I}_{(*)}^T, \qquad \bs{L}_\theta^k = \alpha \, \bs{\hat\theta}^k_{(*)} \bs{I}_{(*)}^T, \qquad \bs{L}_\Gamma^k = \alpha \, \bs{\Gamma}^k_{(*)} \bs{I}_{(*)}^T\]

and

\[\bs{U}^k = \bs{P}_\alpha + (\bs{L}_\Gamma^k)^T \bs{W}^{-1} \bs{L}_\Gamma^k\]

give the a posteriori estimates

\[\bs{\hat\chi}^k_+ = \bs{\hat\chi}^k_- - \bs{L}_\chi^k \bs{M}^k, \qquad \bs{\hat\theta}^k_+ = \bs{\hat\theta}^k_- - \bs{L}_\theta^k \bs{M}^k, \qquad \bs{M}^k = (\bs{U}^k)^{-1} (\bs{L}_\Gamma^k)^T \bs{W}^{-1} E_\alpha\big(\bs{\Gamma}^k_{(*)}\big),\]

and the covariance of the parameters,

\[\bs{P}_\theta^k = \bs{L}_\theta^k (\bs{U}^k)^{-1} (\bs{L}_\theta^k)^T.\]

After the last step, \(\bs{\hat\theta} = \bs{\hat\theta}^{N_T}_+\) is the estimate and \(\bs{P}_\theta = \bs{P}_\theta^{N_T}\) its covariance: the posterior \(\mathcal{N}(\bs{\hat\theta}, \bs{P}_\theta)\). kipe writes both after each step, to the estimation history (Estimation).

In kipe, sampling and correction are kipe.roukf.sample() and kipe.roukf.update(); the propagation of the sigma points and their innovations, which need the solver and the measurements, are done by kipe.estimation.Estimation. The a priori means, which [NAB26] counts to the prediction, start the correction in kipe, since they need no solver. The innovations are weighted with the noise, \(\bs{W}^{-1/2} \bs{\Gamma}^k_{(i)}\), so that \(\bs{W}\) does not appear in the filter’s code.

Outer iterations

The estimate of one pass over the measurements is biased towards the prior. Repeated passes remove the bias (estimation.iterations): each starts from the previous estimate, with the initial covariance and the initial state,

\[\bs{\theta}^{0,(j+1)} = \bs{\hat\theta}^{(j)}, \qquad \bs{P}_\theta^{0,(j+1)} = \bs{P}_\theta^0, \qquad \bs{\hat\chi}^{0,(j+1)}_+ = \bs{\chi}^0,\]

with \(\bs{\theta}^{0,(0)} = \bs{\theta}^0\). \(\bs{\theta}\) stays relative to the prior mean \(\bs{\phi}^0\) in all passes, so the prior of each pass is the initial one, centered at the previous estimate. For the log form, its spread is then relative to the previous estimate, since \(\mathrm{d}\phi_i / \mathrm{d}\theta_i = \phi_i\); for the multiplicative and additive forms, it is the same physical spread in every pass. For a linear least-squares problem, the iterations converge linearly to the minimizer of the data misfit (see [NAB26]).