[R] MCMCpack combining chains

Alan Kelly AKELLY at tcd.ie
Sun Feb 27 13:00:56 CET 2011


Thank you Uwe for the clarification.
Alan Kelly


On 24.02.2011 17:48, Alan Kelly wrote:
> Deal all, as MCMClogit does not allow for the specification of several chains, I have run my model 3 times with different random number seeds and differently dispersed multivariate normal priors.
> For example:
> res1 = MCMClogit(y~x,b0=0,B0=0.001,data=mydat, burnin=500, mcmc=5500, seed=1234, thin=5)
> res2 = MCMClogit(y~x,b0=1,B0=0.01,data=mydat, burnin=500, mcmc=5500, seed=5678, thin=5)
> res3 = MCMClogit(y~x,b0=5,B0=0.0001,data=mydat, burnin=500, mcmc=5500, seed=91011, thin=5)
> 
> Each result produces an object of class mcmc.
> In order to use the Gelman-Rubin diagnostic test via coda, I need to "combine" these 3 mcmc objects appropriately.  I thought that this would be possible using as.mcmc.list() as the function description says:
> The function ?mcmc.list? is used to represent parallel runs of the same chain, with different starting values and random seeds. The list must be balanced: each chain in the list must have the same iterations and the same variables.
> So I try the following:
> res123=as.mcmc.list(res1, res2, res3)


Use mcmc.list() rather than as.mcmc.list(). The latter is for
conversion, not a constructor from separate mcmc objects.

Uwe Ligges



More information about the R-help mailing list