Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to combine multiple chains from rjags into one chain in R?

Tags:

r

jags

I typically call JAGS from rjags with several chains for diagnostic purposes (e.g., 4 chains). After that I often want to do some post processing on the posterior parameter estimates (e.g., use predicted values, compute additional statistics). However, at this point it is a nuisance having the chains stored in a list.

What's a good way to combine the chains into a single parameter list?

like image 273
Jeromy Anglim Avatar asked Jul 22 '14 04:07

Jeromy Anglim


1 Answers

The runjags package has the function combine.mcmc. Its default setting is to combine one or more chains and return a single chain. E.g.,

library(runjags)
fit <- combine.mcmc(multichainfit)

It also has other options for combining chains.

like image 105
Jeromy Anglim Avatar answered Nov 10 '22 07:11

Jeromy Anglim