However, I am using the
rjagspackage. When I try to plot the results of the function
R2WinBUGS::plot.mcmc.listthe results are diagnostic plots (parameter density, chain time series, autocorrelation) for each parameter.
Below is the type of plot that I would like to produce, from Andrew Gelman’s tutorial “Running WinBuugs and OpenBugs from R”. These were produced by using the
The problem is that
bugsobject as an argument, while
plot.mcmc.listtakes the output of
Here is an example (from the
library(rjags) data(LINE) LINE$recompile() LINE.out <- coda.samples(LINE, c("alpha","beta","sigma"), n.iter=1000) plot(LINE.out)
What I need is either
- a way to generate a similar, information-rich, one-page summary plot similar to the one produced by
- a function that will convert
LINE.outto a bugs object or
Since there are no answers, I will at least post what I have gotten so far:
as.bugs.array function in the
R2WinBUGS package was created for this purpose. According to the documentation (
Function converting results from Markov chain simulations, that might not be from BUGS, to bugs object. Used mainly to display results with plot.bugs.
Thus, it is possible to obtain a plot from
LINE.out in your example, although it does not plot the correct variables:
plot(as.bugs.array(sims.array = as.array(LINE.out)))
It will take a little bit more work to determine the correct way to transform the
LINE.out, and the
LINE.samples object from
example(jags.samples) may be an easier place to start.