Automatic differentiation, including support for Hamiltonian Monte Carlo and Laplace approximation is now part of our version 1.0.0 release.  Instructions for trying it are in our User Manual.

[DEPRECATED as of 2023-05-25]

A beta-testing version of NIMBLE provides automatic differentiation, which in turn enables methods such as Hamiltonian Monte Carlo (HMC) and Laplace approximation. HMC is provided separately in the nimbleHMC package.

For users interested in ecological models (including Hidden Markov Models and capture-recapture models, which are really more general than ecology), the marginal distributions in the nimbleEcology package have been updated to support AD, also in a beta release.

You will need the remotes R package installed to use the following instructions.

To install NIMBLE’s testing version (release candidate) with AD support, do:
remotes::install_github("nimble-dev/nimble", ref="AD-rc1", subdir="packages/nimble", quiet=TRUE)

This might take several minutes.

To install the testing version of nimbleHMC (which will only work after the previous step), do:
remotes::install_github("nimble-dev/nimbleHMC", ref="AD-rc1", subdir = "nimbleHMC")

Windows users might need to include an additional argument to install nimbleHMC:
remotes::install_github("nimble-dev/nimbleHMC", ref="AD-rc1", subdir = "nimbleHMC", INSTALL_opts = "--no-multiarch")

To install the testing version of nimbleEcology with AD support, do:
remotes::install_github("nimble-dev/nimbleEcology", ref = "AD-rc0")

A draft chapter of the NIMBLE User Manual describing how to use AD, including examples with HMC and Laplace approximation, is here.