Website | Documentation | Examples | Developing | Workshop materials
NIMBLE is an R package for hierarchical statistical modeling (aka graphical modeling). It enables writing general models along with methods such as Markov chain Monte Carlo (MCMC), particle filtering (aka sequential Monte Carlo), Laplace approximation and other general methods.
For writing statistical models, NIMBLE adopts and extends the BUGS language, making it largely compatible with BUGS and JAGS. NIMBLE makes BUGS extensible, allowing users to add new functions and new distributions.
For writing algorithms (aka analysis methods), NIMBLE provides a model-generic programming system embedded within R. This provides control over models as generic objects and mathematical manipulation of model variables. In this way, NIMBLE's programming paradigm treats probabilistic graphical models as a basic programming construct.
Both models and algorithms are compiled via generating customized C++ and providing seamless interfaces to compiled C++ from R.
NIMBLE's most developed methods are for MCMC. Users can easily customize sampler configurations from R and write new samplers in NIMBLE's algorithm programming system.
Developers of new computational statistical methods can build them in NIMBLE to gain the benefits of its graphical modeling language, compilation, and distribution via CRAN.
NIMBLE needs a C++ compiler and the GNU make
utility.
Typically, Mac users can obtain these by installing Xcode, including
command line utilities, while Windows users can obtain them by
installing Rtools.
See the User Manual for more details.
The easiest way to install NIMBLE is via CRAN:
install.packages("nimble")
To install from the NIMBLE website:
library(devtools)
install.packages("nimble", type = "source", repos = "https://r-nimble.org")
Note that NIMBLE's sequential Monte Carlo (SMC; aka particle filtering) methods are now (as of version 0.10.0) in the nimbleSMC
package.
Note that MCMCsuite
and compareMCMCs
have been migrated to the compareMCMCs
package, now available on CRAN.
In published work that uses or mentions NIMBLE, please cite:
de Valpine, P., D. Turek, C.J. Paciorek, C. Anderson-Bergman, D. Temple Lang, and R. Bodik. 2017. Programming with models: writing statistical algorithms for general model structures with NIMBLE. Journal of Computational and Graphical Statistics 26:403-413. https://doi.org/10.1080/10618600.2016.1172487.
In published work that uses NIMBLE, please also cite the package version:
de Valpine, P., C. Paciorek, D. Turek, N. Michaud, C. Anderson-Bergman, F. Obermeyer, C. Wehrhahn Cortes, A. Rodriguez, D. Temple Lang, W. Zhang, S. Paganin, and P. van Dam-Bates. 2024. NIMBLE: MCMC, Particle Filtering, and Programmable Hierarchical Modeling. doi: 10.5281/zenodo.1211190. R package version 1.2.1, https://cran.r-project.org/package=nimble.
To help us track usage to justify funding support for NIMBLE, please include the DOI in the citation.
Nimble is released under a mixture of licenses, and depends on additional third-party libraries with compatible licenses.
The development of NIMBLE has been funded by:
with additional support provided by postdoctoral funding for D. Turek from the Berkeley Institute for Data Science and Google Summer of Code fellowships for N. Michaud (2015) and C. Lewis-Beck (2017).