Skip to contents

This function collapses MCMC chains from an RTMB/ADNUTS object, generates model reports for each posterior draw, and extracts specified components of the report.

Usage

get_model_rep_from_mcmc(rtmb_obj, adnuts_obj, what, n_cores)

Arguments

rtmb_obj

An RTMB object created via `ADFun`.

adnuts_obj

An `adnuts` object containing MCMC samples.

what

Character vector specifying the names of components in the model report to extract.

n_cores

Number of cores to use

Value

A named list of `data.table`s, one for each element in `what`. Each table contains the melted report component across all posterior samples, with an additional column `posterior_sample` indicating the MCMC draw index.

Examples

if (FALSE) { # \dontrun{
model_reports <- get_model_rep_from_mcmc(rtmb_obj, adnuts_obj,
                                         what = c("SSB", "Rec"))
} # }