posterior {SAMtool} | R Documentation |
Sample posterior of TMB models in SAMtool
Description
A convenient wrapper function (posterior
) to sample the posterior using MCMC in rstan
and returns a stanfit
object for diagnostics. Use RCMstan
to update the RCM and the enclosed operating model
with MCMC samples..
Usage
posterior(x, ...)
## S4 method for signature 'RCModel'
posterior(
x,
priors_only = FALSE,
laplace = FALSE,
chains = 2,
iter = 2000,
warmup = floor(iter/2),
thin = 5,
seed = 34,
init = "last.par.best",
cores = chains,
...
)
## S4 method for signature 'Assessment'
posterior(x, priors_only = FALSE, ...)
RCMstan(RCModel, stanfit, sim, cores = 1, silent = FALSE)
Arguments
x |
An object of class Assessment or RCModel. |
... |
Additional arguments to pass to |
priors_only |
Logical, whether to set the likelihood to zero and sample the priors only. |
laplace |
Logical, whether to do the Laplace approximation for random parameters. |
chains |
The numer of MCMC chains. |
iter |
The number of iterations for each chain, including warmup. |
warmup |
The number of burnin iterations |
thin |
The frequency at which iterations are kept (e.g., |
seed |
Seed for random number generator during the MCMC. |
init |
The initial values of parameters for starting the MCMC chain. See |
cores |
The number of cores for running in parallel, e.g., one core per MCMC chain. Used in |
RCModel |
An object of class |
stanfit |
An object of class |
sim |
A matrix of |
silent |
Logical to indicate if progress messages should be printed to console. |
Value
posterior
returns an object of class stanfit
. See class?stanfit
.
RCMstan
returns an updated RCModel
.
Online Documentation
A vignette on the steps to run the MCMC is available on the openMSE website.
Author(s)
Q. Huynh