Provides a complete R interface to LibBi, a library for Bayesian inference (see < http://libbi.org> and
RBi is an R
interface to libbi, a library for Bayesian inference.
It mainly contains:
bi_model
class, to manipulate libbi modelslibbi
wrapper class, to perform Bayesian using libbi inference from within R,RBi requires R (>= 2.12.1) as well as the packages:
reshape2
ncdf4
data.table
The easiest way to install the latest stable version of RBi is via CRAN. The package is called rbi
(all lower case):
install.packages('rbi')
Alternatively, the current development version can be installed using the devtools
package
library('devtools')install_github("libbi/rbi")
The RBi package has only been tested on GNU/Linux and OS X, but it should mostly work everywhere R
works.
If you want to use RBi as a wrapper to LibBi then you need a working version of LibBi. To install LibBi on a Mac or Unix, the easiest way is to install Homebrew (on OS X) or Linuxbrew (on linux), followed by (using a command shell, i.e. Terminal or similar):
brew install libbi
The path to libbi
script can be passed as an argument to RBi, otherwise the package tries to find it automatically using the which
linux/unix command.
If you just want to process the output from LibBi, then you do not need to have LibBi installed.
A good starting point is to look at the included demos:
demo(PZ_generate_dataset) ## generating a data set from a model demo(PZ_PMMH) ## particle Markov-chain Metropolis-Hastings demo(PZ_SMC2) ## SMC^2 demo(PZ_filtering) ## filtering
For further information, have a look at the introductory vignette from the link from the rbi CRAN package.
LibBi contains the get_traces
method which provides an interface to coda.
For higher-level methods to interact with LibBi, have a look at RBi.helpers.
bi_generate_dataset
join
and logLik
libbi
optiondry
optionwithout
optionspredict
functionsupplement
option to save_libbi
to store supplementary informationlibbi
callsattach_file
function, a more general version of the former add_output
file
option for bi_read
predict
ns
or other dimensionslibbi
calls now finish and yield a warning if the call to the libbi executable fails; this makes it possible to inspect the object to diagnoise the problemstr
and summary
methods defined for libbi
objects, and sample
, filter
and optimise
commands for running LibBibi_read
are much fasterbi_read
when reading variables with one dimensionbi_generate_dataset
now has a seed optionextract_sample
function for extracting a single sample from a NetCDF fileadd_output
option for reconstructing libbi
objectsbi_contents
to quickly get the variables in an NetCDF filegenerate_seed
to generate a seed for a libbi
runsample_obs
option to libbi$run
, to sample posterior observationsbi_model
result
field in the libbi
objectbi_model$get_vars
that didn't remove all spacesbi_read
bi_model$fix
that ignored input variablesclient
is now an option to libbi$run
libbi$initialize
get_traces
if there is only one samplebi_model$insert_lines
can now work with blocksbi_generate_dataset
(#3, #5, @tyler-abbot)stringr
dependencyburnin
option to get_traces
bi_write
coord_dim
option in bi_write
bi_generate_dataset
now returns observationsRcpp
dependencyncdf4
package for interaction with netCDF filesbi_model
class to manipulate modelsinit
, obs
and input
as R objectsbi_wrapper
to libbi
bi_read
function to directly read from libbi
objects