tidy.mcmc.list: Return a tidy data summary of an MCMC object

Description Usage Arguments Value Author(s) Examples

View source: R/tidy-mcmc-list.R

Description

tidy.mcmc.list is a function that behaves like those from broom. It takes an mcmc.list object from coda.samples and return a data frame that summarises each parameters with its mean and quantiles and returns the output as a data.table object. This can be called as tidy. Currently summarises over all chains.

Usage

1
2
## S3 method for class 'mcmc.list'
tidy(x, conf_level = c(0.95), chain = FALSE, colnames = NULL, ...)

Arguments

x

object of class "mcmc.list", as you would find with fitting a model using jags.model(), and coda.samples.

conf_level

level of the credible interval to be calculated. Can be multiple values.

chain

whether or not to summarise each parameter for each chain

colnames

which parameters we want from mcmc_object, if NULL then all columns get selected

...

extra arguments

Value

a data.table containing parameter summaries

Author(s)

Sam Clifford, sj.clifford@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(coda)
data(line)
tidy(line)
# Optionally ask for a subset of parameters with a vector of `colnames`,
# and summarise for each chain:
tidy(line,
     chain = TRUE,
     colnames=c("alpha"))
# can provide two levels of confidence:
tidy(line, conf_level = c(0.95, 0.50))
tidy(line, conf_level = c(0.95))
tidy(line, conf_level = c(0.89, 0.25))

njtierney/mmcc documentation built on Oct. 5, 2021, 12:14 a.m.