mcmcr: An R package to manipulate Markov Chain Monte Carlo samples

knitr::opts_chunk$set(echo = TRUE, warning = FALSE, messages = FALSE, fig.width = 8, fig.height = 12)

Summary

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:

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.

References



Try the mcmcr package in your browser

Any scripts or data that you put into this service are public.

mcmcr documentation built on Sept. 7, 2021, 1:07 a.m.