R Interface to LibBi

Provides a complete R interface to LibBi, a library for Bayesian inference (see < http://libbi.org> for more information). This includes functions for manipulating LibBi models, for reading and writing LibBi input/output files, for converting LibBi output to provide traces for use with the coda package, and for running LibBi from R.


[RBi] (https://github.com/libbi/RBi) is an R interface to [libbi] (http://libbi.org), a library for Bayesian inference.

It mainly contains:

  • various functions to retrieve and process the results from libbi (which are in NetCDF format)
  • a bi_model class, to manipulate libbi models
  • a libbi wrapper class, to perform Bayesian using libbi inference from within R,

Installation

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 via the homebrew-science tap: Install Homebrew (on OS X) or Linuxbrew (on linux), then issue the following commands (using a command shell, i.e. Terminal or similar):

brew tap homebrew/science
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.

Getting started

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

Using coda

LibBi contains the get_traces method which provides an interface to coda.

Other packages

For higher-level methods to interact with LibBi, have a look at RBi.helpers.

News

rbi 0.6.0

  • bi_contents to quickly get the variables in an NetCDF file
  • generate_seed to generate a seed for a libbi run
  • new sample_obs option to libbi$run, to sample posterior observations
  • improved option handling; there is now only one 'options' option
  • overloaded subset operators in bi_model
  • no more result field in the libbi object
  • new vignette: Introduction to rbi
  • Fixed bug in bi_model$get_vars that didn't remove all spaces
  • Fixed bug in reading in the coord dimension(s) in bi_read
  • Fixed bug in bi_model$fix that ignored input variables

rbi 0.5.0

  • client is now an option to libbi$run
  • Fix bug in parsing options in libbi$initialize
  • Fix bug in get_traces if there is only one sample
  • bi_model$insert_lines can now work with blocks
  • Improve cloning, where all initialising parameters can now be passed

rbi 0.4.1

  • Change package name to lower case
  • Tidy up for CRAN submission
  • Fix finding libbi path
  • Fix handling of config options (#2, @tyler-abbot)
  • Fix options in bi_generate_dataset (#3, #5, @tyler-abbot)
  • Fix demos (#1, #6, @tyler-abbot)
  • Remove stringr dependency

rbi 0.4

  • Guess time dimension in netCDF files
  • Bug fixes to better deal with multiple coordinate variables
  • burnin option to get_traces
  • Reduce memory use when thinning

rbi 0.3

  • Bug fixes in bi_write
  • Improve dealing with different types of dimensions, including introduction of the coord_dim option in bi_write
  • bi_generate_dataset now returns observations
  • Remove Rcpp dependency

rbi 0.2

  • Remove C code and use ncdf4 package for interaction with netCDF files
  • Introduce the bi_model class to manipulate models
  • Allow giving init, obs and input as R objects
  • Rename bi_wrapper to libbi
  • Improved bi_read function to directly read from libbi objects

rbi 0.1

  • initial version

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("rbi")

0.8.0 by Sebastian Funk, 2 months ago


https://github.com/libbi/RBi


Report a bug at https://github.com/libbi/RBi/issues


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


Authors: Pierre E. Jacob [aut], Anthony Lee [ctb], Lawrence M. Murray [ctb], Sebastian Funk [aut, cre]


Documentation:   PDF Manual  


GPL-3 license


Imports ncdf4, data.table, reshape2

Suggests coda, R.rsp, testthat, stringi

System requirements: LibBi (>= 1.2.0)


See at CRAN