Interface to the 'C++' Library 'Pf'

Builds and runs 'c++' code for classes that encapsulate state space model, particle filtering algorithm pairs. Algorithms include the Bootstrap Filter from Gordon et al. (1993) , the generic SISR filter, the Auxiliary Particle Filter from Pitt et al (1999) , and a variety of Rao-Blackwellized particle filters inspired by Andrieu et al. (2002) . For more details on the 'c++' library 'pf', see Brown (2020) .


pfR

pfR is the R interface to the c++ particle filtering library pf.

Have a new model you want to quickly write a particle filter for? Quickly generate 99% of the code, fill in your model/algorithm details, and then compile.

Step 1: Download

Either clone this repository, or type the following into R:

devtools::install_github("tbrown122387/pfr")

Step 2: Auto-generate code

Pick your particle filter, generate most of the required c++ code, then fill in the rest. For example,

library(pfr)
createPFCPPTemplates("svol_leverage", "BSWC", fileDir = "~/Desktop/")

Saves three files to your desktop: svol_leverage_bswc.h, svol_leverage_bswc.cpp, and svol_leverage_bswc_export.cpp. After you're finished filling in the details, they should look like this, this, and this, respectively.

Step 3: Compile and Load

Compile the c++ code with

svol_lev <- buildModelFuncs("~/Desktop", "svol_leverage")

Step 4: Run

Call your model's functions with

svol_lev$svol_leverage_bswc_approx_LL(rnorm(100), c(.9, 0.0, 1.0, -.2))
svol_lev$svol_leverage_bswc_approx_filt(rnorm(100), c(.9, 0.0, 1.0, -.2))

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("pfr")

1.0.1 by Taylor Brown, 3 years ago


Browse source code at https://github.com/cran/pfr


Authors: Taylor Brown [aut, cre]


Documentation:   PDF Manual  


GPL (>= 3) license


Imports inline, methods, rstudioapi

Suggests BH, Rcpp, RcppEigen, knitr, rmarkdown


See at CRAN