|
|
RcppSMC | |||||
|
Bio Code rcpp changelog rcppexamples rcpparmadillo rcppgsl rcppsmc rinside rquantlib rpostgresql rprotobuf rvowpalwabbit rdieharder littler random digest beancounter smtm yahooquote octave-mt octave-pg Papers Talks Linux Quantian About Blog
|
OverviewRcppSMC combines SMCTC template classes for Sequential Monte Carlo and Particle Filters (Johansen, 2009, J Statistical Software, 30:6) with the Rcpp package for R/C++ Integration (Eddelbuettel and Francois, 2011, J Statistical Software, 40:8).RcppSMC allows for easier and more direct access from R to the computational core of the SMC algorithm. Sequential Monte Carlo methods are a very general class of Monte Carlo methods for sampling from sequences of distributions. Simple examples of these algorithms are used very widely in the tracking and signal processing literature. Recent developments illustrate that these techniques have much more general applicability, and can be applied very effectively to statistical inference problems. Unfortunately, these methods are often perceived as being computationally expensive and difficult to implement. By combining the SMCTC with the 'glue' provided by Rcpp, a tighter integration with R is achieved. This allows the applied researcher interested in Sequential Monte Carlo and Particle Filter methods to more easily vary input data, summarize outputs, plot results and so on. As a concrete example, figure 5.1 of Johansen (2009) which illustrates a Particle Filter for a two-dimensional linear state space model with non-Gaussian observation error, is reproduced by where we select the optional plot. Moreover, progress during the model fit can also be visualized (using callbacks into R from C++ which Rcpp provides) viares <- pfLineartBS(plot=TRUE) whereres <- pfLineartBS(onlinePlot=pfLineartBSOnlinePlot) pfLineartBSOnlinePlot() is a default plotting function provided for
this example by the package.
Two more 'classic' examples from the literature have been added to the
package:
So give me an example!As of version 0.1.0, the functions are included which reproduce examples from the literature. As noted above, running(which is part ofres <- pfLineartBS(plot=TRUE) example(pfLineartBS) too) creates the following chart
Running the example for the function creates the following plot (which reproduces example 4.1 of Gordon, Salmon and Smith (1993) and their nonlinear model)sim <- simNonlin(len=50) res <- pfNonlinBS(sim$data,particles=500,plot=TRUE)
Note that the data is freshly simulated, so the chart will vary unless the RNG seed is fixed. Lastly, running reproduces the example from Doucet, Briers and Senecal (2006):sim <- simGaussian(len=250) res <- blockpfGaussianOpt(sim$data,lag=5,plot=TRUE)
Where do I get itRcppSMC is now a CRAN package, lives otherwise in its own habitat on R-Forge within Rcpp and can also be downloaded from the local Rcpp archive.Information about SMCTC is also at this page. AuthorsRcppSMC is being written by Dirk Eddelbuettel and Adam M. Johansen.LicenseRcppSMC is licensed under the GNU GPL version 2 or later. |
|||||