Converting coda objects to bugs objects

Jarrett Byrnes writes,

A number of us use JAGS, so we import the results of our Bayesian analysis using coda, so I whipped up a quick mcmc2bugs script so that we could also use the functions in R2WinBUGS. I don’t know if you’ll find it useful (or if I’ve duplicated something that already exists – I don’t think so) but, just in case, I’ve posted it here. [link fixed, thanks to lostnihilist]

Perhaps this should be combined with the as.bugs.array() function that’s in R2WinBUGS.

3 thoughts on “Converting coda objects to bugs objects

  1. Ideally, I would like to have the R interface to JAGS return an object that could be coerced to any desired format ("mcmc", or "bugs", or "rv").

    I'm afraid that I don't use R2WinBUGS. But I've had a brief look at the code. If you have defined an object of class "bugs", then it would be useful to define an "as.bugs" generic, so that people can write methods for other classes. Jarrett's mcmc2bugs function would then be the method for mcmc objects.

  2. Odd. I find coda plot, summary, etc. methods more useful than those in R2WinBUGS —
    maybe I just haven't figured out what methods
    work with "bugs" objects. Anyway, my emdbook
    package (on CRAN) has an "as.mcmc.bugs" function
    (for converting bugs to a coda mcmc object),
    and a "lump.mcmc.list" function — for when you
    think your chains have converged and you'd like
    to do inference on a single combined distribution
    (if this is not kosher, someone could warn me …)

    By the way, the URL for the functions
    is wacky — Firefox takes me to a Wikipedia
    entry on HTML. Weird. (I was able to
    tweak it to get to the functions.)

    cheers
    Ben Bolker
    (slightly daunted to be posting in Gelman-land)

Comments are closed.