summary_mcmc: Summarize MCMC Draws Stored in an Array

View source: R/summary_mcmc.R

summary_mcmcR Documentation

Summarize MCMC Draws Stored in an Array

Description

Summarizes posterior draws stored in the same array layout used by MCMC_Fit: iterations by chains by variables. The returned object uses the same columns and print method as MCMC_Fit$summary().

Usage

summary_mcmc(draws, pars = NULL, chains = NULL, max_rows = 10, digits = 2)

Arguments

draws

A numeric three-dimensional array with dimensions iterations by chains by variables.

pars

Optional numeric or character vector selecting variables. Character values may be full variable names (for example, '"beta[1]"') or base names (for example, '"beta"'). Prefix character names with '"-"' to exclude them.

chains

Optional numeric vector selecting chains. Positive and negative integer indexing are supported.

max_rows

Maximum number of variables to include. Use 'NULL' to include all variables.

digits

Number of decimal places used when printing the result.

Value

A data frame with class '"summary_BayesRTMB"' containing posterior means, standard deviations, marginal MAP estimates, 95 percent intervals, bulk and tail effective sample sizes, and split R-hat values.

Examples

set.seed(123)
draws <- array(
  rnorm(200 * 2 * 2),
  dim = c(200, 2, 2),
  dimnames = list(NULL, c("chain1", "chain2"), c("alpha", "beta"))
)
summary_mcmc(draws)


BayesRTMB documentation built on Nov. 24, 2026, 9:06 a.m.