# Ensemble Kalman methods

Data Assimilation; Data fusion; Sloppy filters for over-ambitious models

June 22, 2015 — May 27, 2024

Bayes
distributed
dynamical systems
ensemble
generative
graphical models
linear algebra
machine learning
Monte Carlo
optimization
probabilistic algorithms
probability
sciml
signal processing
state space models
statistics
stochastic processes
swarm
time series

$\renewcommand{\var}{\operatorname{Var}} \renewcommand{\cov}{\operatorname{Cov}} \renewcommand{\dd}{\mathrm{d}} \renewcommand{\bb}[1]{\mathbb{#1}} \renewcommand{\vv}[1]{\boldsymbol{#1}} \renewcommand{\rv}[1]{\mathsf{#1}} \renewcommand{\vrv}[1]{\vv{\rv{#1}}} \renewcommand{\disteq}{\stackrel{d}{=}} \renewcommand{\gvn}{\mid} \renewcommand{\Ex}{\mathbb{E}} \renewcommand{\Pr}{\mathbb{P}} \renewcommand{\one}{\unicode{x1D7D9}}$

A random-sampling variant/generalisation of the Kalman-Bucy filter. That also describes particle filters, but the randomisation in ensemble methods is different than those. We can do both types of randomisation. This sent has a few tweaks that make it more tenable in tricky situations with high dimensional state spaces or nonlinearities in inconvenient places. A popular data assimilation method for spatiotemporal models.

## 1 Tutorial introductions

Katzfuss, Stroud, and Wikle (2016);Roth et al. (2017);Fearnhead and Künsch (2018), are all pretty good. Schillings and Stuart (2017) has been recommended by Haber, Lucka, and Ruthotto (2018) as the canonical modern version. Wikle and Berliner (2007) present a broad data assimilation context on these methods, although it is too curt to be helpful for me. Mandel (2009) is helpfully longer. The inventor of the method explains it in Evensen (2003), but I found that hard going, since it uses too much oceanography terminology. Roth et al. (2017) is probably the best for my background. Let us copy their notation.

We start from the discrete-time state-space models; the basic one is the linear system \begin{aligned} x_{k+1} &=F x_{k}+G v_{k}, \\ y_{k} &=H x_{k}+e_{k}, \end{aligned} with state $$x\in\mathbb{R}^n$$ and the measurement $$y\in\mathbb{R}^m$$. The initial state $$x_{0}$$, the process noise $$v_{k}$$, and the measurement noise $$e_{k}$$ are mutually independent such that \begin{aligned} \Ex x_{0}&=\hat{x}_{0}\\ \Ex v_{k}&=0\\ \Ex e_{k}&=0\\ \cov x_{0} &=P_{0}\\ \cov v_{k} & =Q\\ \cov e_{k}&=R \end{aligned} and all are Gaussian.

The Kalman filter propagates state estimates $$\hat{x}_{k \mid k}$$ and covariance matrices $$P_{k \mid k}$$ for this model. The KF update or prediction or forecast is given by the step \begin{aligned} &\hat{x}_{k+1 \mid k}=F \hat{x}_{k \mid k} \\ &P_{k+1 \mid k}=F P_{k \mid k} F^{\top}+G Q G^{\top} \end{aligned} We predict the observations forward using these state estimates via \begin{aligned} \hat{y}_{k \mid k-1} &=H \hat{x}_{k \mid k-1}, \\ S_{k} &=H P_{k \mid k-1} H^{\top}+R . \end{aligned} Given these and an actual observation, we update the state estimates using a gain matrix, $$K_{k}$$ \begin{aligned} \hat{x}_{k \mid k} &=\hat{x}_{k \mid k-1}+K_{k}\left(y_{k}-\hat{y}_{k \mid k-1}\right) \\ &=\left(I-K_{k} H\right) \hat{x}_{k \mid k-1}+K_{k} y_{k}, \\ P_{k \mid k} &=\left(I-K_{k} H\right) P_{k \mid k-1}\left(I-K_{k} H\right)^{\top}+K_{k} R K_{k}^{\top}. \end{aligned} in what geoscience types refer to as an analysis update. The variance-minimising gain is given $K_{k}=P_{k \mid k-1} H^{\top} S_{k}^{-1}=M_{k} S_{k}^{-1},$ where $$M_{k}$$ is the cross-covariance between the state and output predictions.

In the Ensemble Kalman filter, we approximate some of these quantities of interest using samples; this allows us to relax the assumption of Gaussianity and gets us computational savings in certain problems of interest. That does sound very similar to particle filters, and indeed there is a relation.

Instead of maintaining the $$n$$-dimensional estimate $$\hat{x}_{k \mid k}$$ and the $$n \times n$$ covariance $$P_{k \mid k}$$ as such, we maintain an ensemble of $$N<n$$ sampled state realizations $X_{k}:=\left[x_{k}^{(i)}\right]_{i=1}^{N}.$ This notation is intended to imply that we are treating these realisations as an $$n \times N$$ matrix $$X_{k \mid k}$$ with columns $$x_{k}^{(i)}$$. We introduce the following notation for ensemble moments: \begin{aligned} &\bar{x}_{k \mid k}=\frac{1}{N} X_{k \mid k} \one \\ &\bar{P}_{k \mid k}=\frac{1}{N-1} \widetilde{X}_{k \mid k} \widetilde{X}_{k \mid k}^{\top}, \end{aligned} where $$\one=[1, \ldots, 1]^{\top}$$ is an $$N$$-dimensional vector and $\widetilde{X}_{k \mid k}=X_{k \mid k}-\bar{x}_{k \mid k} \one^{\top}=X_{k \mid k}\left(I_{N}-\frac{1}{N} \one \one^{\top}\right)$ is an ensemble of anomalies/deviations from $$\bar{x}_{k \mid k}$$, which I would call it the centred version. We attempt to match the moments of the ensemble with those realised by a true Kalman filter, in the sense that \begin{aligned} &\bar{x}_{k \mid k}:=\frac{1}{N} \sum_{i=1}^{N} x_{k}^{(i)} \approx \hat{x}_{k \mid k}, \\ &\bar{P}_{k \mid k}:=\frac{1}{N-1} \sum_{i=1}^{N}\left(x_{k}^{(i)}-\bar{x}_{k \mid k}\right)\left(x_{k}^{(i)}-\bar{x}_{k \mid k}\right)^{\top} \approx P_{k \mid k} . \end{aligned} The forecast step computes $$X_{k+1 \mid k}$$ such that its moments are close to $$\hat{x}_{k+1 \mid k}$$ and $$P_{k+1 \mid k}$$. An ensemble of $$N$$ independent process noise realizations $$V_{k}:=\left[v_{k}^{(i)}\right]_{i=1}^{N}$$ with zero mean and covariance $$Q$$, is used in $X_{k+1 \mid k}=F X_{k \mid k}+G V_{k}.$

Next the $$X_{k \mid k-1}$$ is adjusted to obtain the filtering ensemble $$X_{k \mid k}$$ by applying an update to each ensemble member: With some gain matrix $$\bar{K}_{k}$$ the KF update is applied to the ensemble by the update $X_{k \mid k}=\left(I-\bar{K}_{k} H\right) X_{k \mid k-1}+\bar{K}_{k} y_{k} \one^{\top} .$ This does not yet approximate the update of the full Kalman observation — there is no term $$\bar{K}_{k} R \bar{K}_{k}^{\top}$$; We have a choice how to implement that.

### 1.1 Stochastic EnKF update

In the stochastic method, we use artificial zero-mean measurement noise realizations $$E_{k}:=\left[e_{k}^{(i)}\right]_{i=1}^{N}$$ with covariance $$R$$. $X_{k \mid k}=\left(I-\bar{K}_{k} H\right) X_{k \mid k-1}+\bar{K}_{k} y_{k} \one^{\top}-\bar{K}_{k} E_{k} .$ The resulting $$X_{k \mid k}$$ has the correct ensemble mean and covariance, $$\hat{x}_{k \mid k}$$ and $$P_{k \mid k}$$.

If we define a predicted output ensemble $Y_{k \mid k-1}=H X_{k \mid k-1}+E_{k}$ that evokes the classic Kalman update (and encapsulates information about) $$\hat{y}_{k \mid k-1}$$ and $$S_{k}$$, we can rewrite this update into one that resembles the Kalman update: $X_{k \mid k}=X_{k \mid k-1}+\bar{K}_{k}\left(y_{k} \one^{\top}-Y_{k \mid k-1}\right) .$

Now, the gain matrix $$\bar{K}_{k}$$ in the classic KF is computed from the covariance matrices of the predicted state and output. In the EnKF, the required $$M_{k}$$ and $$S_{k}$$ must be estimated from the prediction ensembles. The obvious way of doing that is to once again centre the ensemble, \begin{aligned} &\widetilde{X}_{k \mid k-1}=X_{k \mid k-1}\left(I_{N}-\frac{1}{N} \one \one^{\top}\right) \\ &\widetilde{Y}_{k \mid k-1}=Y_{k \mid k-1}\left(I_{N}-\frac{1}{N} \one \one^{\top}\right) \end{aligned} and use the empirical ensemble covariances \begin{aligned} \bar{M}_{k} &=\frac{1}{N-1} \widetilde{X}_{k \mid k-1} \widetilde{X}_{k \mid k-1}^{\top}, \\ \bar{S}_{k} &=\frac{1}{N-1} \widetilde{Y}_{k \mid k-1} \widetilde{Y}_{k \mid k-1}^{\top} . \end{aligned} The gain $$\bar{K}_{k}$$ is then the solution to the system of linear equations, $\bar{K}_{k} \widetilde{Y}_{k \mid k-1} \widetilde{Y}_{k \mid k-1}^{\top}=\widetilde{X}_{k \mid k-1} \widetilde{Y}_{k \mid k-1}^{\top}$

### 1.2 Deterministic update

Resemblance to unscented/sigma-point filtering also apparent. TBD.

The additive measurement noise model we have used the $$e_{k}$$ for should not affect the cross covariance $$M_k$$. Thus it is reasonable to make the substitution $\widetilde{Y}_{k \mid k-1}\longrightarrow \widetilde{Z}_{k \mid k-1}=H \widetilde{X}_{k \mid k-1}$ to get a less noisy update \begin{aligned} \bar{M}_{k} &=\frac{1}{N-1} \widetilde{X}_{k \mid k-1} \widetilde{Z}_{k \mid k-1}^{\top} \\ \bar{S}_{k} &=\frac{1}{N-1} \widetilde{Z}_{k \mid k-1} \widetilde{Z}_{k \mid k-1}^{\top}+R \end{aligned} The Kalman gain $$\bar{K}_{k}$$ is then computed as in the KF. Or we can interpret it as a matrix square-root $$R^{\frac{1}{2}}$$ with $$R^{\frac{1}{2}} R^{\frac{\top}{2}}=R$$ and then factorize $\bar{S}_{k}=\left[\begin{array}{cc}\frac{1}{\sqrt{N-1}} \widetilde{Z}_{k \mid k-1}\quad R^{\frac{1}{2}}\end{array}\right] \left[\begin{array}{c}\frac{1}{\sqrt{N-1}} \widetilde{Z}^{\top}_{k \mid k-1} \\ R^{\frac{\top}{2}}\end{array}\right].$

TBD: EAKF and ETKF which deterministically propagate an estimate $P_{k \mid k}^{\frac{1}{2}} P_{k \mid k}^{\frac{\top}{2}}=P_{k \mid k}$ which introduces less sampling noise. Roth et al. (2017) explain it as rewriting the measurement update to use a square root $$P_{k \mid k-1}^{\frac{1}{2}}$$ and in particular the ensemble approximation $$\frac{1}{N-1} \widetilde{X}_{k \mid k-1}$$ : \begin{aligned} P_{k \mid k} &=\left(I-K_{k} H\right) P_{k \mid k-1} \\ &=P_{k \mid k-1}^{\frac{1}{2}}\left(I-P_{k \mid k-1}^{\frac{\top}{2}} H^{\top} S_{k}^{-1} H P_{k \mid k-1}^{\frac{1}{2}}\right) P_{k \mid k-1}^{\frac{\top}{2}} \\ & \approx \frac{1}{N-1} \widetilde{X}_{k \mid k-1}\left(I-\frac{1}{N-1} \widetilde{Z}_{k \mid k-1}^{\top} \bar{S}_{k}^{-1} \widetilde{Z}_{k \mid k-1}\right) \widetilde{X}_{k \mid k-1}^{\top}. \end{aligned} Factorising, $\left(I-\frac{1}{N-1} \widetilde{Z}_{k \mid k-1}^{\top} \bar{S}_{k}^{-1} \widetilde{Z}_{k \mid k-1}\right)=\Pi_{k}^{\frac{1}{2}} \Pi_{k}^{\frac{\top}{2}},$ The $$\Pi_{k}^{\frac{1}{2}}\in\mathbb{R}^{N\times N}$$ can be used to create a deviation ensemble $\tilde{X}_{k \mid k}=\tilde{X}_{k \mid k-1} \Pi_{k}^{\frac{1}{2}}$ that correctly encodes $$P_{k \mid k}$$ without using random perturbations. The actual filtering is achieved by updating each sample according to $\bar{x}_{k \mid k}=\left(I-\bar{K}_{k} H\right) F_{x_{k-1 \mid k-1}}+\bar{K}_{k} y_{k},$ where $$\bar{K}_{k}$$ is computed from the deviation ensembles.

## 2 As least-squares

TBD. Permits calculating the operations without forming covariance matrices.

## 3 As Approximate Bayesian computation

Nott, Marshall, and Ngoc (2012) uses Beaumont, Zhang, and Balding (2002);, Blum and François (2010) and Lei and Bickel (2009) to view EnKF this as an approximate Bayesian computation algorithm.

## 4 Going nonlinear

TBD

The EnKF does not necessarily converge to a Kalman filter in the limit of infinite ensemble size

## 5 Monte Carlo moves in the ensemble

The ensemble is rank deficient. Question: When can we sample other states from the ensemble to improve the rank by stationary posterior moves?

TBD

## 7 Ensemble methods in smoothing

Katzfuss, Stroud, and Wikle (2016) claims there are two major approaches to smoothing: Stroud et al. (2010) -type reverse methods, and the EnKS which augments the states with lagged copies rather than doing a reverse pass.

Here are some other papers I saw N. K. Chada, Chen, and Sanz-Alonso (2021);Luo et al. (2015);White (2018);Zhang et al. (2018).

## 8 System identification in

Can we use ensemble methods for online parameter estimation? Apparently. Evensen (2009b);Malartic, Farchi, and Bocquet (2021);Moradkhani et al. (2005);Fearnhead and Künsch (2018).

## 9 Theoretical basis for probabilists

Bishop and Del Moral (2023);P. Del Moral, Kurtzmann, and Tugaut (2017);Garbuno-Inigo et al. (2020);Kelly, Law, and Stuart (2014);Le Gland, Monbet, and Tran (2009);Taghvaei and Mehta (2021).

## 10 Lanczos trick in precision estimates

Pleiss et al. (2018),Ubaru, Chen, and Saad (2017).

## 11 Localization

Hunt, Kostelich, and Szunyogh (2007); Ott et al. (2004); Ott et al. (2004)

## 12 Relation to particle filters

Intimate. See particle filters.

## 13 Schilling’s filter

Claudia Schilling’s filter is an elegant version which looks somehow more general than the original but also simpler. Haber, Lucka, and Ruthotto (2018) use it to train neural nets (!) and show a rather beautiful connection to stochastic gradient descent in section 3.2.

## 14 Handy low-rank tricks for

See low-rank tricks.

## 16 References

Alsup, Venturi, and Peherstorfer. 2022. In Proceedings of the 2nd Mathematical and Scientific Machine Learning Conference.
Alzraiee, White, Knowling, et al. 2022. Environmental Modelling & Software.
Ambrogioni, Guclu, and van Gerven. 2019.
Ameli, and Shadden. 2023. Applied Mathematics and Computation.
Anderson, Jeffrey L. 2007. Physica D: Nonlinear Phenomena, Data Assimilation,.
———. 2009. IEEE Control Systems Magazine.
Anderson, Jeffrey, Hoar, Raeder, et al. 2009. Bulletin of the American Meteorological Society.
Beaumont, Zhang, and Balding. 2002. Genetics.
Bickel, and Levina. 2008. The Annals of Statistics.
Bishop, and Del Moral. 2019. Electronic Journal of Probability.
———. 2023. Mathematics of Control, Signals, and Systems.
Bishop, Del Moral, and Niclas. 2020. Annales de l’Institut Henri Poincaré, Probabilités Et Statistiques.
Bishop, Del Moral, and Pathiraja. 2017. arXiv:1701.05978 [Math].
Blum, and François. 2010. Statistics and Computing.
Bocquet, Pires, and Wu. 2010. Monthly Weather Review.
Botha, Adams, Tran, et al. 2022.
Chada, Neil K., Chen, and Sanz-Alonso. 2021. Foundations of Data Science.
Chada, Neil, and Tong. 2022. Mathematics of Computation.
Chen, Chong, Dou, Chen, et al. 2022. The Journal of Supercomputing.
Chen, Yan, and Oliver. 2013. Computational Geosciences.
Chen, Yuming, Sanz-Alonso, and Willett. 2021.
Del Moral, P., Kurtzmann, and Tugaut. 2017. SIAM Journal on Control and Optimization.
Del Moral, Pierre, and Niclas. 2018.
Dolcetti, and Pertici. 2020.
Dubrule. 2018. In Handbook of Mathematical Geosciences: Fifty Years of IAMG.
Duffin, Cripps, Stemler, et al. 2021. Proceedings of the National Academy of Sciences.
Dunbar, Duncan, Stuart, et al. 2022. SIAM Journal on Applied Dynamical Systems.
Evensen. 1994. Journal of Geophysical Research: Oceans.
———. 2003. Ocean Dynamics.
———. 2004. Ocean Dynamics.
———. 2009a. Data Assimilation - The Ensemble Kalman Filter.
———. 2009b. IEEE Control Systems.
Evensen, and van Leeuwen. 2000. Monthly Weather Review.
Fearnhead, and Künsch. 2018. Annual Review of Statistics and Its Application.
Finn, Geppert, and Ament. 2021. Preprint.
Furrer, R., and Bengtsson. 2007. Journal of Multivariate Analysis.
Furrer, Reinhard, Genton, and Nychka. 2006. Journal of Computational and Graphical Statistics.
Galy-Fajou, Perrone, and Opper. 2021. Entropy.
Garbuno-Inigo, Hoffmann, Li, et al. 2020. SIAM Journal on Applied Dynamical Systems.
Grooms, and Robinson. 2021. PLOS ONE.
Grumitt, Karamanis, and Seljak. 2023.
Guth, Schillings, and Weissmann. 2020.
Haber, Lucka, and Ruthotto. 2018. arXiv:1805.08034 [Cs, Math].
Heemink, Verlaan, and Segers. 2001. Monthly Weather Review.
Hou, Lawrence, and Hero. 2016. arXiv:1610.00195 [Physics, Stat].
Houtekamer, and Mitchell. 2001. Monthly Weather Review.
Houtekamer, and Zhang. 2016. Monthly Weather Review.
Huang, Schneider, and Stuart. 2022. Journal of Computational Physics.
Hunt, Kostelich, and Szunyogh. 2007. Physica D: Nonlinear Phenomena, Data Assimilation,.
Julier, and Uhlmann. 1997. In Signal Processing, Sensor Fusion, and Target Recognition VI.
Kantas, Doucet, Singh, et al. 2015. Statistical Science.
Katzfuss, Stroud, and Wikle. 2016. The American Statistician.
Kelly, Law, and Stuart. 2014. Nonlinearity.
Kovachki, and Stuart. 2019. Inverse Problems.
Kuzin, Yang, Isupova, et al. 2018. 2018 21st International Conference on Information Fusion (FUSION).
Labahn, Wu, Harris, et al. 2020. Flow, Turbulence and Combustion.
Lakshmivarahan, and Stensrud. 2009. IEEE Control Systems Magazine.
Law, Tembine, and Tempone. 2016. SIAM Journal on Scientific Computing.
Le Gland, Monbet, and Tran. 2009. Report.
Lei, and Bickel. 2009. “Ensemble Filtering for High Dimensional Nonlinear State Space Models.” University of California, Berkeley, Rep.
Lei, Bickel, and Snyder. 2009. Monthly Weather Review.
Luo, Stordal, Lorentzen, et al. 2015. SPE Journal.
Malartic, Farchi, and Bocquet. 2021. arXiv:2107.11253 [Nlin, Physics:physics, Stat].
Mandel. 2009.
Mitchell, and Houtekamer. 2000. Monthly Weather Review.
Nott, Marshall, and Ngoc. 2012. Statistics and Computing.
Nychka, and Anderson. 2010. “Data Assimilation.” In Handbook of Spatial Statistics.
O’Kane, Sandery, Kitsios, Sakov, Chamberlain, Collier, et al. 2021. Journal of Climate.
O’Kane, Sandery, Kitsios, Sakov, Chamberlain, Squire, et al. 2021. Journal of Climate.
Oliver. 2022. Mathematical Geosciences.
Ott, Hunt, Szunyogh, et al. 2004. Tellus A: Dynamic Meteorology and Oceanography.
Pleiss, Gardner, Weinberger, et al. 2018. In.
Popov. 2022. ETD.
Raanes, P. 2016. In.
Raanes, Patrick Nima, Stordal, and Evensen. 2019. Nonlinear Processes in Geophysics.
Reich, and Weissmann. 2019.
Roth, Hendeby, Fritsche, et al. 2017. EURASIP Journal on Advances in Signal Processing.
Routray, Osuri, Pattanayak, et al. 2016. In Advanced Numerical Modeling and Data Assimilation Techniques for Tropical Cyclone Prediction.
Sainsbury-Dale, Zammit-Mangion, and Huser. 2022.
Sandery, O’Kane, Kitsios, et al. 2020. Monthly Weather Review.
Schillings, and Stuart. 2017. SIAM Journal on Numerical Analysis.
Schneider, Stuart, and Wu. 2022. Journal of Computational Physics.
Shumway, and Stoffer. 2011. Time Series Analysis and Its Applications. Springer Texts in Statistics.
Song, Sebe, and Wang. 2022. In.
Spantini, Baptista, and Marzouk. 2022. SIAM Review.
Stordal, Moraes, Raanes, et al. 2021. Mathematical Geosciences.
Stroud, Katzfuss, and Wikle. 2018. Monthly Weather Review.
Stroud, Stein, Lesht, et al. 2010. Journal of the American Statistical Association.
Taghvaei, and Mehta. 2021. IEEE Transactions on Automatic Control.
Tamang, Ebtehaj, van Leeuwen, et al. 2021. Nonlinear Processes in Geophysics.
Tippett, Anderson, Bishop, et al. 2003. Monthly Weather Review.
Ubaru, Chen, and Saad. 2017. SIAM Journal on Matrix Analysis and Applications.
Verlaan, and Heemink. 1997. Stochastic Hydrology and Hydraulics.
Wen, and Li. 2022. Statistics and Computing.
White. 2018. Environmental Modelling & Software.
Wikle, and Berliner. 2007. Physica D: Nonlinear Phenomena, Data Assimilation,.
Wikle, and Hooten. 2010. TEST.
Yang, Stroud, and Huerta. 2018. Bayesian Analysis.
Yegenoglu, Krajsek, Pier, et al. 2020. In Machine Learning, Optimization, and Data Science.
Zhang, Lin, Li, et al. 2018. Water Resources Research.