Hm, I realized that I
announced this on Google+ (via Rcpp) as well as
on the r-packages list,
wrote a new and simple web page for it,
but had not put it on my blog. So here is some catching up.
Sequential Monte Carlo / Particle Filter
is a (to quote the Wikipedia page I just linked to)
sophisticated model estimation technique based on simulation.
They are related to both Kalman Filters, and Markov Chain Monte Carlo
has a rather nice set of C++ classes documentated in his
2009 paper in the Journal of
Statistical Software (JSS).
I started to play with these classes and realized that, once again, this would make
perfect sense in an R extension built with the
package by Romain and
myself (and in JSS too). So I put a first prototype onto R-Forge and emailed
Adam who, to my pleasant surprise, was quite interested. And a couple of
emails, and commits later, we are happy to present a very first release
I wrote a few words on a RcppSMC page
on my website where you can find a few more details. But in short, we
already have example functions demonstrating the backend classes by
reproducing examples from
- Johansen (2009)
- and his example 5.1 via
pfLineartBS()for a linear
- Doucet, Briers and Senecal (2006)
- and their (optimal) block-sampling particle filter for a linear Gaussian model
(serving as an illustration as the setup does of course have an analytical
solution) via the function
- Gordon, Salmond and Smith (1993)
- and their ubiqitous nonlinear state space model via the
And to illustrate just why
is so cool for this, here is a little animation of a callback from the C++
code when doing the filtering on Adam’s example 5.1. By passing a simple
plotting function, written in R, to the C++ code, we can get a plot updated
on every iteration. Here I cheated a little and used our old plot function
with fixed ranges, the package now uses a more general function:
The animation is of course due to ImageMagick glueing one hundred files into
a single animated gif.
More information about RcppSMC is on its page,
and we intend to add more examples and extensions over time.