Description: The 'coda' package (maintainer: Martyn Plummer
plummerm@iarc.fr is commonly used to carry out Markov Chain
Monte Carlo simulations, especially for the analysis of Bayesian
hierarchical models in JAGS (Just Another Gibbs Sampler - also
maintained by Plummer). Package 'coda' has a ton of built-in
functions for viewing and assessing MCMC outputs, but the actual
values it draws from posterior distributions tend to end up buried
inside complex package-specific objects. MCMCwrap provides wrapper
functions for extracting MCMC posterior draws and modes from mcmc.list
objects, generated by coda and organizing them into arrays for easy
plotting and external diagnostics.
mcmc.list
objects.mcmc.list
objects, which are created by various functions in packages 'R2jags' and 'coda'.MCMC_out(x, ...)
x
an mcmc.list
object....
additional arguments passed to density
, which determines posterior modes.mod1 <- jags.model(model_script, data = list(<data>),
inits = function()list(<inits>), n.chains = 3, n.adapt = 2000)
update(mod1, n.iter=5e3)
mod1_out <- coda.samples(mod1, c(<variables out>, n.iter=1e5, thin=100))
MCMCout(mod1_out)
mcmc.list
objects, which are created by various functions in packages 'R2jags' and 'coda'.MCMCout_mix(x, p, nsrc, ...)
x
an mcmc.list
object.p
string; the name of the variable that contains the source proportions to the mxture.nsrc
the number of potential sources to the mixture....
additional arguments passed to density
, which determines posterior modes.mod1 <- jags.model(model_script, data = list(<data>),
inits = function()list(<inits>), n.chains = 3, n.adapt = 2000)
update(mod1, n.iter=5e3)
mod1_out <- coda.samples(mod1, c(<variables out>, n.iter=1e5, thin=100))
MCMCout_mix(model_output, 'prey_proportion', 3)
# devtools lets you install packages from GitHub:
install.packages('devtools')
library(devtools)
# then it's this simple:
install_github('vlahm/MCMCwrap')
library(MCMCwrap)
Mike Vlah: + vlahm13@gmail[dot]com + linkedin.com/in/michaelvlah
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.