post_summ {postpack} | R Documentation |
Obtain posterior summaries and diagnostics of specific nodes
Description
Allows rapid calculation of summaries and diagnostics from specific nodes
stored in mcmc.list
objects.
Usage
post_summ(
post,
params,
digits = NULL,
probs = c(0.5, 0.025, 0.975),
Rhat = FALSE,
neff = FALSE,
mcse = FALSE,
by_chain = FALSE,
auto_escape = TRUE
)
Arguments
post |
A |
params |
A vector of regular expressions specifying the nodes to match for summarization.
Accepts multi-element vectors to match more than one node at a time.
See |
digits |
Control rounding of summaries.
Passed to |
probs |
Posterior quantiles to calculate. Passed to |
Rhat |
Calculate the Rhat convergence diagnostic using |
neff |
Calculate the number of effective MCMC samples using |
mcse |
Calculate the Monte Carlo standard error for the posterior mean and reported quantiles
using the |
by_chain |
Calculate posterior summaries for each chain
rather than for the aggregate across chains? Defaults to |
auto_escape |
Automatically escape |
Value
A matrix
object with summary statistics as rows and nodes as columns.
If by_chain = TRUE
, an array
with chain-specific summaries as the third dimension is returned instead.
See Also
match_params()
, coda::gelman.diag()
, coda::effectiveSize()
, mcmcse::mcse()
, mcmcse::mcse.q()
Examples
# load example mcmc.list
data(cjs)
# calculate posterior summaries for the "p" nodes
# ("p[1]" doesn't exist in model)
post_summ(cjs, "p")
# do this by chain
post_summ(cjs, "p", by_chain = TRUE)
# calculate Rhat and Neff diagnostic summaries as well
# multiple node names too
post_summ(cjs, c("b0", "p"), Rhat = TRUE, neff = TRUE)
# calculate Monte Carlo SE for mean and quantiles, with rounding
post_summ(cjs, "p", mcse = TRUE, digits = 3)
# summarize different quantiles: median and central 80%
post_summ(cjs, "p", probs = c(0.5, 0.1, 0.9))