R has a number of existing Kalman filter packages which are all very noteworthy in their own right. A comparison was provided bythis JSS paper from 2011.
Yet I had a need for something both simple and fast at the C++ level.
TheEKF/UKF toolbox for Matlab proved to be a wonderful source of excellent code that was well documented (see [this 130 page pdf manual]http://becs.aalto.fi/en/research/bayes/ekfukf/documentation.pdf()), under a suitable license and covering both simple examples as well as promising extensions.
This example is not described in the pdf manual, but included as demokf_sine_demo.m within theEKF/UKF sources. A signal is provided via a sine wave plus random noise, and a linear Kalman Filter is used to smooth and filter the series. Our variantdemo/kf_sine_demo.R reproduces the demo via the following chart

This demo is described in detail in Section 2.2.4 on pages 11 to 15 of theEKF/UKF Documentation; the animation is part of the corresponding Matlab code inkf_cwpa_demo.m. We show the two final charts which provide animations of the smoothing and filtering in our versiondemo/kf_cwpa_demo.R:


Working, but still far from complete. We currently support two demo scripts based on linear smoothers and filters. Additional functions should get added over time.
TheEKF/UKF Toolbox for Matlab was written by Simo Särkkä, Jouni Hartikainen, and Arno Solin.
Dirk Eddelbuettel is writing and maintaing this package by porting it to R and C++ viaRcpp and particularlyRcppArmadillo.
This package is released under GNU General Public License, Version 2 or later. EKF/UKF itself (which is included) is released under the GNU General Public License, Versions 2 and 3.
Initially created: Sun Apr 27 07:34:20 CDT 2014
Last modified: Wed Jun 17 18:01:10 CDT 2020