ParticleBayes is an R package that contains a collection of particle filters for a subset of hierarchical bayesian models, with a focus on sequentially learning model parameters alongside state variables. The R code calls an open-source Java library, ParticleLearningModels, to perform calculations, so when/if a practitioner wants to implement a model in production, the underlying, streaming-capable, API is available.

Most models are formulated as dynamic linear models, or mixtures thereof, although some support for hidden markov models exists. The models also implement

Currently, the implemented filters cover two response types:

and, naturally, their univariate equivalents.

Installation from R

ParticleBayes depends on the rJava R package, so make sure it's installed and operational. This also means you'll need to have a functional JRE, so if you don't you can get one from here, install, and then run R CMD javareconf (with sudo if you're using linux) at the command line. If you're using a Mac, you might need to run something like R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers instead. Pay attention for any errors in the output, and look around the internet for more information.

While ParticleBayes is still in it's beta stages, installation in R requires the devtools package and something like the following:

install_url("", subdir="pkg")

then, as usual, add library(ParticleBayes) to your R source to use.
NOTE: This will pick up the most recently pushed version of the code (i.e. the jar file in pkg/inst/java). Inclusion of this file in the repo is temporary, that is, until this package gets submitted to CRAN.

Development Setup and Installation

ParticleBayes uses Maven, so you'll need to download that.
Once you have it, mvn clean package -Dmaven.test.skip=true should create the necessary jars in pkg/inst/java, so that the code is callable from R.
The java code is called, within R, through rJava

Similar to the R installation, and from the project's root directory, one possible development setup script could include



system("mvn clean package -Dmaven.test.skip=true")






The script will build the Java code, install the package in an isolated environment (see devtools), and set up the JVM for debugging.