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), 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
Typically, Mac users can obtain these by installing Xcode, including
command line utilities, while Windows users can obtain them by
See the User Manual for more details.
The easiest way to install NIMBLE is via CRAN:
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
compareMCMCs are being migrated to the
compareMCMCs package. To install this:
library(devtools) install_github("nimble-dev/compareMCMCs", subdir = "compareMCMCs")
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, and S. Paganin. 2021. NIMBLE: MCMC, Particle Filtering, and Programmable Hierarchical Modeling. doi: 10.5281/zenodo.1211190. R package version 0.12.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.
- Nimble's non-C++ code (R, bash, Make, etc.) is released under Revised BSD.
- Nimble's C++ code is released under GPL 2.
- Nimble's User Manual is released under the CC BY 4.0 license.
- The Eigen C++ library included with Nimble is licensed under MPL 2.
The development of NIMBLE has been funded by:
- an NSF Advances in Biological Informatics grant (DBI-1147230) to P. de Valpine, C. Paciorek, and D. Temple Lang;
- an NSF SI2-SSI grant (ACI-1550488) to P. de Valpine, C. Paciorek, and D. Temple Lang; and
- an NSF Collaborative Research grant (DMS-1622444) to P. de Valpine, A. Rodriguez, and C. Paciorek.
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).