Theory
This page covers the mathematical foundations of each filter implemented in TFiltersPy.
Kalman Filter
The Kalman filter is optimal for linear-Gaussian state-space models:
Predict step:
Update step (Joseph form for numerical stability):
The Joseph form update for \(P_{k|k}\) is more numerically stable than the standard \((I - K_k H) P_{k|k-1}\) formulation.
RTS Smoother (backward pass):
Extended Kalman Filter
For nonlinear systems with Gaussian noise:
The EKF linearizes around the current estimate using first-order Taylor expansion:
Then applies the standard Kalman equations with these linearized matrices. Works well when the nonlinearity is mild relative to the uncertainty.
Unscented Kalman Filter
The UKF avoids Jacobians by propagating sigma points through the nonlinear functions. For a state of dimension \(n\):
Sigma point generation (Merwe scaled):
Weights:
The sigma points are propagated through \(f\) and \(h\), and the resulting mean and covariance are computed as weighted averages. This captures second-order statistics without derivatives.
Ensemble Kalman Filter
The EnKF approximates the Kalman filter using a Monte Carlo ensemble of \(M\) state realizations:
Predict: Propagate each member through the dynamics:
Update: Use ensemble statistics instead of full covariance:
The Kalman gain is computed from these ensemble-derived statistics. Each member is updated with a perturbed observation:
This scales to systems with millions of state variables since we never store or invert the full covariance matrix.
Particle Filter
The particle filter represents the posterior using \(N\) weighted samples:
Predict: Draw from the transition model:
Update weights using the observation likelihood:
Weights are normalized to sum to 1.
Systematic resampling is triggered when the Effective Sample Size drops below a threshold:
Systematic resampling has lower variance than multinomial resampling and produces more evenly distributed samples.
State estimate:
References
Kalman, “A New Approach to Linear Filtering and Prediction Problems,” ASME Journal of Basic Engineering, 1960.
Julier and J. K. Uhlmann, “Unscented Filtering and Nonlinear Estimation,” Proceedings of the IEEE, 2004.
Evensen, “Sequential Data Assimilation with a Nonlinear Quasi-Geostrophic Model Using Monte Carlo Methods,” JGR, 1994.
Doucet, N. de Freitas, and N. Gordon, Sequential Monte Carlo Methods in Practice, Springer, 2001.
Rauch, F. Tung, and C. T. Striebel, “Maximum Likelihood Estimates of Linear Dynamic Systems,” AIAA Journal, 1965.