MCMCout_mix: Organize mcmc.list objects from coda/R2jags mixing models

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Get posterior draws, means, and modes for source proportions output by MCMC mixing model simulations.

Usage

1
MCMCout_mix(x, p, nsrc, ...)

Arguments

x

an mcmc.list object from a mixing model.

...

additional arguments passed to 'density', which determines posterior modes.

Details

Takes mcmc.list objects, which are created by various functions in packages 'R2jags' and 'coda'. Returns posterior draws as arrays with dim(sources, observed mixtures, draws). Also returns means and X values of modes (corresponding to highest posterior peaks) as matrices with dim(sources, observed mixtures). Works across all parallel MCMC chains (if running several in tandem).

Value

a list containing arrays of 1) all posterior draws from all parallel chains, 2) posterior means, 3) posterior modes. Only applies to the variable that contains source proportions. For any other monitored variables, use MCMCout.

Author(s)

Mike Vlah, vlahm13@gmail.com

See Also

MCMCout for organized output from non-mixing models.

Examples

1
2
3
4
5
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(mod1_out, 'prey_proportion', 3)

vlahm/MCMCwrap documentation built on May 3, 2019, 6:16 p.m.