If you have a matrix X and you want an mcmc.list object for 3 chains:

as.mcmc.list(lapply(as.data.frame(X), mcmc))

is one way.

Best,
Uwe Ligges


On 02.12.2015 03:47, Margaret Donald wrote:
---------- Forwarded message ----------
From: Margaret Donald <merricks.merri...@gmail.com>
Date: 1 December 2015 at 23:09
Subject: Re: [R] Converting a matrix to an mcmc object
To: Jim Lemon <drjimle...@gmail.com>


Thanks, Jim.  It may well do, but I am struggling to see how to coerce a
matrix into three chains... I could reprogram the whole show run it in
WinBUGS or OpenBUGS and process the coda, but I would prefer not to.

Regards,
Margaret.

On 30 November 2015 at 17:31, Jim Lemon <drjimle...@gmail.com> wrote:

Hi Margaret,
Doesn't the "mcmc" function in the "coda" package create an mcmc object
from a matrix?

Jim


On Mon, Nov 30, 2015 at 9:44 AM, Margaret Donald <
merricks.merri...@gmail.com> wrote:

Dear List,

I am using R2jags and post process some mcmc objects to produce a new
object, which is currently a matrix, which replicates the shape of the
objects from which it is derived.

I want to produce a Gelman-Rubin graph from its (implied) three chains,
but
I need to coerce the matrix into an mcmc object if I am to use gelman.plot
or gelman.diag from the R-package "coda".

(The various mcmc functions in "coda" seem to work in the other
direction.....)

Regards,
Margaret Donald



--
Margaret Donald
Post Doctoral researcher
University of New South Wales
margaret.don...@unsw.edu.au
0405 834 550

         [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.






______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to