Learn R Programming

⚠️There's a newer version (1.1.2) of this package.Take me there.

adnuts

The aim of 'adnuts' (pronounced A-D NUTS like A-D MB) is to provide advanced MCMC sampling for 'ADMB' and 'TMB' models. It mimics 'Stan' in functionality and feel, specifically providing no-U-turn (NUTS) sampling with adaptive mass matrix and parallel execution.

The R package 'tmbstan' (available on CRAN) has largely replaced the TMB capabilities since original development. As such, adnuts is primarily used for ADMB models. See the following paper for an introduction to the package capabilities, and contrast with tmbstan:

Monnahan CC, Kristensen K (2018) No-U-turn sampling for fast Bayesian inference in ADMB and TMB: Introducing the adnuts and tmbstan R packages. PLoS ONE 13(5):e0197954. https://doi.org/10.1371/journal.pone.0197954

'adnuts' was designed specifically for use in fisheries stock assessments, and interested authors are referred to:

Monnahan, C.C., T.A. Branch, J.T. Thorson, I.J. Stewart, C.S. Szuwalksi (in press) Overcoming long Bayesian run times in integrated fisheries stock assessments. ICES Journal of Marine Science. http://dx.doi.org/10.1093/icesjms/fsz059

Usage

The 'sample_admb' function draws posterior samples from an ADMB model using an MCMC algorithm (NUTS by default). The returned fitted object contains samples and other information. The function 'extract_samples' can be used to get posterior samples (post warmup and thinning) into a data frame for inference, while 'launch_shinyadmb' can be used for interactive diagnostics based on 'ShinyStan'.

A brief demonstration file is provided to help get you started, and there is also a user guide: vignette('adnuts') for more detailed information.

Installation

To use the ADMB functionality you need to build your model with version 12.0 (released December 2017) or later, otherwise this functionality is not available. See the ADMB installation instructions for more information.

The adnuts R package version 1.0.1 can be installed from CRAN: install.packages('adnuts').

The development version of 'adnuts' can be installed with devtools::install_github('colemonnahan/adnuts', ref='dev')

Copy Link

Version

Install

install.packages('adnuts')

Monthly Downloads

262

Version

1.0.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Cole Monnahan

Last Published

April 4th, 2019

Functions in adnuts (1.0.1)

launch_shinytmb

Launch shinystan for a TMB fit.
sample_admb_rwm

Run a single random walk Metropolis chain for an ADMB model
sample_inits

Function to generate random initial values from a previous fit using adnuts
adnuts

adnuts: No-U-turn sampling for Template Model Builder and AD Model Builder
sample_tmb_hmc

Draw MCMC samples from a model posterior using a static HMC sampler.
check_identifiable

Check identifiability from model Hessian
sample_tmb_nuts

Draw MCMC samples from a model posterior using the No-U-Turn (NUTS) sampler with dual averaging.
sample_tmb_rwm

[Deprecated] Draw MCMC samples from a model posterior using a Random Walk Metropolis (RWM) sampler.
launch_shinyadmb

Launch shinystan for an ADMB fit.
extract_samples

Extract posterior samples from a model fit.
sample_admb

Bayesian inference of an ADMB model using the no-U-turn sampler.
.getADMBHessian

Read in admodel.hes file
extract_sampler_params

Extract sampler parameters from a fit.
pairs_admb

Plot pairwise parameter posteriors and optionally the MLE points and confidence ellipses.
sample_admb_nuts

Run a single NUTS chain for an ADMB model
sample_tmb

Bayesian inference of a TMB model using the no-U-turn sampler.