get_iters: Get sampled iterations of posterior

Description Usage Arguments Details Value

View source: R/get_iters.R

Description

Given model output from either Stan or JAGS, return a data.table of posterior samples for specified parameters

Usage

1
get_iters(X, pars, lang = c("JAGS", "Stan"), ignore_brackets = TRUE)

Arguments

X

an object containing model output, e.g., as returned by stan or jags

pars

Character vector of parameter names. Note that naming coventions differ slightly for Stan and JAGS

lang

character vector indicating the language that generated X (either "JAGS" or "Stan")

ignore_brackets

logical indicating whether or not the brackets in parameter names should be ignored when matching pars to parameter names in model output. Only implemented for lang == "JAGS" at the moment, and is only used if pars does not contain brackets itself.

Details

It is important to remember that models in the two languages might have different parameters/ parameter names. For example, if there is only one beta_mu parameter, it is beta_mu in JAGS and beta_mu[1] in Stan. Also, logit_psi and logit_theta are tracked in Stan but not JAGS, and Z parameters are only in JAGS. Both the way the models are written and the languages themselves contribute to these differences.

Value

A data.table with columns for each of pars and a column for chain, the latter of which indicates which of the chains the sample is from.


rBatt/trawlDiversity documentation built on June 30, 2017, 1 p.m.