
Obtain samples from the posterior distribution of reported quantities
Source:R/get-posterior.R
get_posterior3.RdWhen samples from the posterior distribution are obtained using tmbstan,
only the model parameters can be accessed directly from the stanfit
object (i.e., derived quantities such as par_B0 or M_a cannot be accessed
directly). Accessing derived quantities must be done using this function.
Arguments
- object
A
listobject. The AD (automatic differentiation) object created usingTMB::MakeADFun, containing the model structure and report function.- posterior
An
rstanobject created using thetmbstanfunction, containing MCMC samples from the posterior distribution.- pars
A
characterstring or vector. The name(s) of the derived parameter(s) to extract from the model report (e.g., "par_B0", "M_a"). Default is "par_B0".- iters
An
integer. The number of posterior iterations to extract. IfNULL(default), all available iterations are extracted.- option
An
integer(1, 2, or 3). Controls parallelization: 1 = non-parallel, 2 = parallel across chains, 3 = parallel across chains and iterations. Default is 1.