announcing the nimbleMacros package and the use of macros in NIMBLE models
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Recent versions of NIMBLE now include the ability to use macros in models. NIMBLE is a system for building and sharing analysis methods for statistical models, especially for hierarchical models and computationally-intensive methods (such as MCMC, Laplace approximation, and SMC).
A NIMBLE macro is a succinct syntax that expands to create the NIMBLE model code for part or all of a model.
We recently released the first version of the `nimbleMacros` package on CRAN, which provides an initial set of macros available to users and developers. As an example, one could set up the code for a linear mixed effects model by using the `LM` (“linear model”) macro like this:
library(nimbleMacros) code <- nimbleCode({ LM(weight[1:N] ~ Time + (1|Chick)) })
with the formula syntax mimicking that of the lme4 package. After building the model based on the `code` object, you can see the model code produced after the macro is expanded with `model$getCode()`. The nimbleMacros package also includes macros for creating linear predictors and for loops, and we plan to add additional macros in the future.
Developers can use the tools in `nimble` itself to create their own macros. See Section 12.4 of the NIMBLE user manual, the `nimbleMacros` vignette, or `help(buildMacro)` for more information.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.