Initial release 0.1.0 of package RcppSMC

March 24, 2012
By

(This article was first published on Thinking inside the box , and kindly contributed to R-bloggers)

Hm, I realized that I
announced this on Google+ (via Rcpp) as well as
on Twitter,
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
methods.

href="http://www2.warwick.ac.uk/fac/sci/statistics/staff/academic-research/johansen/">Adam Johansen
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
Rcpp
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
0.1.0.

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
bootstrap example;

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 blockpfGaussianOpt()

Gordon, Salmond and Smith (1993)

and their ubiqitous nonlinear state space model via the
function pfNonlinBS().

And to illustrate just why
Rcpp
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:


alt="Example of RcppSMC callback to R plot when estimation example 5.1 from Johansen (2009)">

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.

To leave a comment for the author, please follow the link and comment on his blog: Thinking inside the box .

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.