knitr::opts_chunk$set(echo = TRUE, warning = FALSE, messages = FALSE, fig.width = 8, fig.height = 12)
The results of Bayesian analyses are fully described by the posterior distribution for each term in the model. Bayesian software packages such as BUGS, JAGS and STAN use one or more chains to iteratively draw samples from the posterior distributions using Markov Chain Monte Carlo (MCMC) methods.
While a simple parameter such as an intercept corresponds to a single term, more complex parameters consist of multiple terms with their own inherent dimensionality.
The mcmcr
package includes two related classes which preserve the dimensionality of the parameters.
The first, mcmcr::mcmcarray
, stores the samples in an array where the first dimension is the chains, the second dimension is the iterations and the subsequent dimensions represent the dimensionality of the parameter.
The second class, mcmcr::mcmcr
, stores multiple mcmcarray
objects with the same number of chains and iterations.
It was developed to allow a set of dimensionality preserving parameters from a single analysis to be manipulated as a whole.
The package includes functions to:
mcarray
and mcmc.list
objects; converged
using rhat
and esr
(effectively sampling rate);coef
table; subset
an object by its chains, iterations and/or parameters;mcmc_map
over an objects values.The mcmcr
package provides an integrated framework for storing, manipulating and summarising MCMC samples.
library(mcmcr) mcmcr_example coef(mcmcr_example)
The software archive is at https://github.com/poissonconsulting/mcmcr.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.