Version 1.3.0 of NIMBLE released

We’ve released the newest version of NIMBLE on CRAN and on our website. 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).

Version 1.3.0 provides some new and improved functionality, plus some bug fixes and improved error trapping.

The new and improved functionality includes:

  • A new multivariate sampler, the Barker proposal sampler (sampler_barker). We encourage users to try this sampler in place of the block Metropolis RW_block sampler and let us know how well it works. The Barker sampler uses gradient information and may improve adaptation behavior, including
    better mixing when parameters are on different scales or the initialproposal scale is too large.
  • An improved Laplace/AGHQ implementation that includes use of the nlminb optimizer for both inner and outer optimization (for better optimization performance), improved messaging and output naming, returning the log-likelihood and degrees of freedom for model selection calculations, and unified control of optimization method and other controls at either the build stage or through the updateSettings method.
  • The addition of the BOBYQA optimization method through nimOptim, registered via nimOptimMethod.

In addition to the new and improved functionality above, other bug fixes, improved error trapping, and enhancements include:

  • Preventing the use of nimbleFunction method names and nimbleFunction names that conflict with names in the nimble language (DSL).
  • More carefully checking for and warning of cases of NaN and non-finite log probability values in various samplers that in some cases may indicate invalid MCMC sampling.
  • More carefully handling of NaN and non-finite log probability values in the CRP sampler.
  • Error trapping cases of dynamic indices producing a non-scalar result in AD-enabled models and provide a suggested work-around.
  • Error trapping use of a non-existent nimbleList.
  • Preventing use of a single seed when running multiple chains via runMCMC.
  • Improving messaging related to lack of derivative support for functions.
  • Adding information about model macros to the manual.
  • Fixing bug in caching values in the CRP sampler when maximum number of clusters is exceeded, which would have caused incorrect sampling (albeit with the user having been warned that they should increase the maximum number of clusters).
  • Fixing an issue preventing use of nimbleList elements in nimCat.
  • Preventing an adaptation interval of one for various block samplers for which an interval of one leads to an error.
  • Allowing runLaplace to use an uncompiled Laplace object.

Please see the release notes on our website for more details.

Version 1.2.1 of NIMBLE released

We’ve released the newest version of NIMBLE on CRAN and on our website. 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).

This is a micro release that primarily addresses some packaging changes requested by CRAN. In addition, this release includes:

  • A multinomial MCMC sampler, sampler_RW_multinomial, for random variables following a multinomial distribution.
  • Some enhancements to error trapping and warning messages.
  • A variety of minor bug fixes.

Version 1.2.0 of NIMBLE released

We’ve released the newest version of NIMBLE on CRAN and on our website. 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).

This release provides provides extensive new functionality, including:

  • A Pólya-gamma sampler, `sampler_polyagamma`, for conjugate sampling of linear predictor parameters in logistic regression model specifications, including handling zero inflation and stochastic design matrices. This sampler must be added to an MCMC configuration manually.
  • A new sampler, `sampler_noncentered`, which samples the mean or standard deviation of a set of random effect values in a transformed space such that the random effects are deterministically shifted or scaled given new values of their hyperparameters. For random effects written in a centered parameterization, sampling is performed as if they had been written in a noncentered parameterization, thereby enabling a variant on the Yu and Meng (2011) interweaving sampling strategy of sampling in both parameterizations.This sampler must be added to an MCMC configuration manually.
  • Adaptive Gauss-Hermite quadrature (AGHQ) for integrating over continuous latent effects, as an extension of NIMBLE’s Laplace approximation functionality. We also add user-friendly R functions, `runLaplace` and `runAGHQ`, for using Laplace and AGHQ approximation for maximum likelihood estimation.
  • A more flexible optimization system via `nimOptim`, with support for `nlminb` built in as well as the capability for users to provide potentially arbitrary optimization functions in R.
  • Allowing the use of nimbleFunctions with setup code in models, either for user-defined functions via `<-` or for user-defined distributions via `~`. This supports holding large objects outside of model nodes for use in models.
  • A completely revamped MCEM algorithm, using automatic derivatives in the maximization when possible, fixing a bug so that any parts of the model not connected to the latent states are included in MLE calculations, giving greater control and adding minor extensions to the ascent-based MCEM approach, and converting `buildMCEM` to be a nimbleFunction rather than an R function.

In addition to the new functionality above, other enhancements and bug fixes include:

  • Improving the speed of MCMC and MCMC building in certain cases.
  • Adding an argument to buildMCMC controlling whether to initialize values in the model.
  • Providing the ability to control the number of digits printed in C++ output.
  • Allowing use of a categorical MCMC sampler with user-specified dcat-like distributions.
  • Warning of use of backward indexing in models.
  • Improve documentation of the LKJ distribution and of advanced aspects of writing code for derivative tracking using the AD system.
  • Fixing an insufficient check for conjugacy in stick-breaking specifications of Bayesian nonparametric distributions.
  • Fixing compilation failures occurring on Red Hat Linux.
  • Reenabling functionality for user-provided Eigen library and related updates to the autoconf configuration used in package building.
  • Enhancing functionality to support model macros, which will be fully released and documented in the future.
  • Removing deprecated `is.na.vec` and `is.nan.vec` functions.
  • Improving some warnings and error messages.

Please see the release notes on our website for more details.

Version 1.1.0 of NIMBLE released

We’ve released the newest version of NIMBLE on CRAN and on our website. 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).

This release provides new functionality as well as various bug fixes and improved error trapping, including:

  • Improving our automatic differentiation (AD) system so it can be used in a wider range of  models, including models with stochastic indexing, discrete latent states, and CAR distributions. Support for AD for these models means that HMC sampling and Laplace approximation can be used.
  • Allowing distributions and functions (whether user-defined or built-in) that lack AD support (such as dinterval, dconstraint, and truncated distributions) to be used and compiled in AD-enabled models. The added flexibility increases the range of models in which one can use AD methods (HMC or Laplace) on some parts of a model and other samplers or methods on other parts.
  • Adding nimIntegrate to the NIMBLE language, providing one-dimensional numerical integration via adaptive quadrature, equivalent to R’s integrate. This can, for example, be used in a user-defined function or distribution for use in model code, such as to implement certain point process or survival models that involve a one-dimensional integral.
  • Adding a “prior samples” MCMC sampler, which uses an existing set of numerical samples to define the prior distribution of model node(s).
  • Better support of the dCRP distribution in non-standard model structures.
  • Adding error trapping to prevent accidental use of  C++ keywords as model variable names.
  • Removing the RW_multinomial MCMC sampler, which was found to generate incorrect posterior results (in cases when a latent state followed a multinomial distribution)
  • Fixing a bug in conjugacy checking in a case of subsets of multivariate nodes.
  • Fixing is.na and is.nan to operate in the expected vectorized fashion.
  • Improving documentation of AD, nimbleHMC, and nimbleSMC in the manual.
  • Updating Eigen (the C++ linear algebra library used by nimble) to version 3.4.0.

Please see the release notes on our website for more details.

nimbleHMC version 0.2.0 released, providing improved HMC performance

nimbleHMC provides Hamiltonian Monte Carlo samplers for use with NIMBLE, in particular NUTS samplers. NIMBLE’s HMC samplers can be flexibly assigned to a subset of model parameters, allowing users to consider various sampling configurations.

We’ve released version 0.2.0 of nimbleHMC, which includes a new default NUTS sampler inspired by Stan’s implementation of NUTS. It also provides an updated version of our previous NUTS sampler (which is based on the original Hoffman and Gelman paper, and is now called the ‘NUTS_classic’ sampler in NIMBLE) that fixes performance issues in version 0.1.1.

Version 1.0.1 of NIMBLE released, fixing a bug in version 1.0.0 affecting certain models

We’ve released the newest version of NIMBLE on CRAN and on our website. NIMBLE is a system for building and sharing analysis methods for statistical models, especially for hierarchical models and computationally-intensive methods (such as MCMC and SMC).
Version 1.0.1 follows shortly after 1.0.0 and fixes an issue and a bug introduced in version 1.0.0 causing data to be set incorrectly in certain models.
Both cases occur only when a variable (e.g., “x”) contains both stochastic nodes (e.g. “x[2] ~ <some distribution>”) and *either* deterministic nodes (e.g. “x[3] <- <some calculation>”) or right-hand-side-only nodes (e.g. “x[4]” appears only on the right-hand-side, like an explanatory value).
The issue involves a change of behavior (relative to previous nimble versions) when both setting data values for some nodes and initial values for other nodes within the same variable (that satisfies the previous condition). Data values for right-hand-side-only nodes were replaced by initial values (inits) if both were provided. Version 1.0.1 reverts to previous behavior that data values are not replaced by initial values in that situation.
The bug involves models where (for a variable satisfying the previous condition) not every scalar element within the variable is used as a node and some of the nodes in the variable are data. In that situation, data values may be set incorrectly. This could typically occur in models with autoregressive structure directly on some data nodes (such as may be the case for capture-recapture models involving many individual capture histories within the same variable, indexed by individual and time, with some individuals not present for the entire time series, resulting in unused scalar elements of the variable).
Please see the release notes on our website for more details.

Version 1.0.0 of NIMBLE released, providing automatic differentiation, Laplace approximation, and HMC sampling

We’ve released the newest version of NIMBLE on CRAN and on our website. NIMBLE is a system for building and sharing analysis methods for statistical models, especially for hierarchical models and computationally-intensive methods (such as MCMC and SMC).

Version 1.0.0 provides substantial new functionality. This includes:

  • A Laplace approximation algorithm that allows one to find the MLE for model parameters based on approximating the marginal likelihood in models with continuous random effects/latent process values.
  • A Hamiltonian Monte Carlo (HMC) MCMC sampler implementing the NUTS algorithm (available in the newly-released nimbleHMC package).
  • Support in NIMBLE’s algorithm programming system to obtain derivatives of functions and arbitrary calculations within models.
  • A parameter transformation system allowing algorithms to work in unconstrained parameter spaces when model parameters have constrained domains.

These are documented via the R help system and a new section at the end of our User Manual. We’re excited for users to try out the new features and let us know of their experiences. In particular, given these major additions to the NIMBLE system, we anticipate the possibility of minor glitches. The best place to reach out for support is still the nimble-users list.

In addition to the new functionality above, other enhancements and bug fixes include:

  • Fixing a bug (previously reported in a nimble-users message) giving incorrect results in NIMBLE’s cross-validation function (`runCrossValidate`) for all but the ‘predictive’ loss function for NIMBLE versions 0.10.0 – 0.13.2.
  • Fixing a bug in conjugacy checking causing incorrect identification of conjugate relationships in models with unusual uses of subsets, supersets, and slices of multivariate normal nodes.
  • Improving control of the `addSampler` method for MCMC.
  • Improving the WAIC system in a few small ways.
  • Enhancing error trapping and warning messages.

Please see the NEWS file in the package source for more details.

Bug in newly-released version 0.13.0 affecting MCMC for models with predictive nodes

We recently released version 0.13.0, which has some improvements in how we handle predictive nodes in NIMBLE’s MCMC engine.

Unfortunately, we realized (thanks to a user post from a couple days ago) that there is a bug in this new approach to predictive nodes.

If you haven’t upgraded to version 0.13.0, simply wait to upgrade until we release a bug fix in 0.13.1 in the next couple weeks.

If you have upgraded to version 0.13.0 and if you have run an MCMC on a model that both (1) has predictive nodes and (2) has multivariate nodes, then the bug might affect your results. Please set:

  nimbleOptions(MCMCusePredictiveDependenciesInCalculations = TRUE)

and then reconfigure/rebuild and rerun your MCMC. The option above will ensure that the MCMC behaves as it would in previous versions of NIMBLE.

Keep everything organized in Ledger Live for Mac by tagging and taking notes so you can easily take note of your transactions and later refer to them.

Version 0.13.0 of NIMBLE released

We’ve released the newest version of NIMBLE on CRAN and on our website. NIMBLE is a system for building and sharing analysis methods for statistical models, especially for hierarchical models and computationally-intensive methods (such as MCMC and SMC).
Version 0.13.0 provides new functionality (in particular improved handling of predictive nodes in MCMC) and minor bug fixes, including:

  • Thoroughly revamping handling of posterior predictive nodes in the MCMC system, in particular that MCMC samplers, by default, will now exclude predictive dependencies from internal sampler calculations. This should improve MCMC mixing for models with predictive nodes. Posterior predictive nodes are now sampled conditional on all other model nodes at the end of each MCMC iteration.
  • Adding functionality to the MCMC configuration system, including a new replaceSamplers method and updates to the arguments for the addSamplers method.
  • Adding an option to the WAIC system to allow additional burnin (in addition to standard MCMC burnin) before calculating online WAIC, thereby allowing inspection of initial samples without forcing them to be used for WAIC.
  • Warning users of unused constants during model building.
  • Fixing bugs that prevented use of variables starting with ‘logProb’ or named ‘i’ in model code.
  • Fixing a bug to prevent infinite recursion in particular cases in conjugacy checking.
  • Fixing a bug in simulating from dcar_normal nodes when multiple nodes passed to simulate.
Please see the release notes on our website for more details.

Keep everything organized in Ledger Live for Mac by tagging and taking notes so you can easily take note of your transactions and later refer to them.