diff --git a/man/adnuts-package.Rd b/man/adnuts-package.Rd index 587fbbf..a93bf8a 100644 --- a/man/adnuts-package.Rd +++ b/man/adnuts-package.Rd @@ -2,6 +2,7 @@ % Please edit documentation in R/adnuts-package.R \docType{package} \name{adnuts-package} +\alias{adnuts} \alias{adnuts-package} \title{adnuts: No-U-turn sampling for AD Model Builder (ADMB)} \description{ diff --git a/man/adnuts.Rd b/man/adnuts.Rd deleted file mode 100644 index 89aaf50..0000000 --- a/man/adnuts.Rd +++ /dev/null @@ -1,77 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/_adnuts-package.R -\name{adnuts} -\alias{adnuts} -\title{adnuts: No-U-turn sampling for AD Model Builder (ADMB)} -\description{ -Draw Bayesian posterior samples from an ADMB model using the -no-U-turn MCMC sampler. Adaptation schemes are used so specifying tuning -parameters is not necessary, and parallel execution reduces overall run -time. -} -\details{ -The software package Stan pioneered the use of no-U-turn (NUTS) sampling -for Bayesian models (Hoffman and Gelman 2014, Carpenter et -al. 2017). This algorithm provides fast, efficient sampling across a -wide range of models, including hierarchical ones, and thus can be used -as a generic modeling tool (Monnahan et al. 2017). The functionality -provided by \pkg{adnuts} is based loosely off Stan and \R package -\pkg{rstan} - -The \pkg{adnuts} \R package provides an \R workflow for NUTS - sampling for ADMB models (Fournier et al. 2011), including - adaptation of step size and metric (mass matrix), parallel - execution, and links to diagnostic and inference tools - provided by \pkg{rstan} and \pkg{shinystan}. The ADMB - implementation of NUTS code is bundled into the ADMB source - itself (as of version 12.0). Thus, when a user builds an - ADMB model the NUTS code is incorporated into the model - executable. Thus, \pkg{adnuts} simply provides a convenient - set of wrappers to more easily execute, diagnose, and make - inference on a model. More details can be found in the - package vignette. - -Note that previous versions of \pkg{adnuts} included - functionality for TMB models, but this has been replaced by - \pkg{tmbstan} (Kristensen et al. 2016, Monnahan and - Kristensen 2018). -} -\references{ -Carpenter, B., Gelman, A., Hoffman, M.D., Lee, D., Goodrich, B., - Betancourt, M., Riddell, A., Guo, J.Q., Li, P., Riddell, A., - 2017. Stan: A Probabilistic Programming Language. J Stat - Softw. 76:1-29. - -Fournier, D.A., Skaug, H.J., Ancheta, J., Ianelli, J., Magnusson, A., - Maunder, M.N., Nielsen, A., Sibert, J., 2012. AD Model Builder: using - automatic differentiation for statistical inference of highly - parameterized complex nonlinear models. Optim Method - Softw. 27:233-249. - -Hoffman, M.D., Gelman, A., 2014. The no-U-turn sampler: adaptively - setting path lengths in Hamiltonian Monte Carlo. J Mach Learn - Res. 15:1593-1623. - -Kristensen, K., Nielsen, A., Berg, C.W., Skaug, H., Bell, B.M., - 2016. TMB: Automatic differentiation and Laplace approximation. J - Stat Softw. 70:21. - -Kristensen, K., 2017. TMB: General random effect model builder tool - inspired by ADMB. R package version 1.7.11. - -Monnahan, C.C., Thorson, J.T., Branch, T.A., 2017. Faster estimation of - Bayesian models in ecology using Hamiltonian Monte Carlo. Methods in - Ecology and Evolution. 8:339-348. - -Monnahan C.C., 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 - -Stan Development Team, 2016. Stan modeling language users guide and - reference manual, version 2.11.0. - -Stan Development Team, 2016. RStan: The R interface to Stan. R package -version 2.14.1. http://mc-stan.org. -} -\keyword{internal} diff --git a/man/as.tmbfit.Rd b/man/as.tmbfit.Rd new file mode 100644 index 0000000..ddf7d79 --- /dev/null +++ b/man/as.tmbfit.Rd @@ -0,0 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sparse.R +\name{as.tmbfit} +\alias{as.tmbfit} +\title{Construtor for tmbfit objects} +\usage{ +as.tmbfit(x, mle, invf) +} +\arguments{ +\item{x}{A fitted MCMC object} + +\item{mle}{A list of MLE parameters} + +\item{invf}{The inverse function for the parameters} +} +\description{ +Construtor for tmbfit objects +} diff --git a/man/dot-rotate_space.Rd b/man/dot-rotate_space.Rd new file mode 100644 index 0000000..41c0ab7 --- /dev/null +++ b/man/dot-rotate_space.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{.rotate_space} +\alias{.rotate_space} +\title{Update algorithm for mass matrix.} +\usage{ +.rotate_space(fn, gr, M, y.cur) +} +\arguments{ +\item{fn}{The current fn function.} + +\item{gr}{The current gr function} + +\item{M}{The new mass matrix} + +\item{y.cur}{The current parameter vector in unrotated (Y) space.} +} +\description{ +Update algorithm for mass matrix. +} diff --git a/man/get_post.Rd b/man/get_post.Rd new file mode 100644 index 0000000..4a2d8e7 --- /dev/null +++ b/man/get_post.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sparse.R +\name{get_post} +\alias{get_post} +\title{Extract posterior samples from a tmbfit object} +\usage{ +get_post(x, invf, parnames, array = FALSE) +} +\arguments{ +\item{x}{A fitted tmbfit object} + +\item{invf}{The inverse function to decorrelate the parameters} + +\item{parnames}{A vector of parameter names, excluding lp__} + +\item{array}{Whether to return a data.frame (default) or array +which is used in constructing other objects downstream} +} +\description{ +Extract posterior samples from a tmbfit object +} diff --git a/man/sample_sparse_tmb.Rd b/man/sample_sparse_tmb.Rd new file mode 100644 index 0000000..0dd8ad9 --- /dev/null +++ b/man/sample_sparse_tmb.Rd @@ -0,0 +1,38 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sparse.R +\name{sample_sparse_tmb} +\alias{sample_sparse_tmb} +\title{Fit a TMB model using a sparse inverse mass matrix} +\usage{ +sample_sparse_tmb( + obj, + iter, + warmup, + cores, + chains, + control = NULL, + seed = NULL +) +} +\arguments{ +\item{obj}{The TMB object with random effects turned on and +optimized} + +\item{iter}{Total iterations to run (warmup + sampling)} + +\item{warmup}{Total warmup iterations} + +\item{cores}{Number of parallel cores to use} + +\item{chains}{Number of chains} + +\item{control}{NUTS control list} + +\item{seed}{Random number seed} +} +\value{ +A fitted MCMC object of class 'adfit' +} +\description{ +Fit a TMB model using a sparse inverse mass matrix +}