mcmc model stops running

Welcome to the forum for R2MLwiN users. Feel free to post your question about R2MLwiN here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to R2MLwiN: Running MLwiN from within R >> http://www.bris.ac.uk/cmm/software/r2mlwin/
Post Reply
med151991
Posts: 13
Joined: Tue Dec 11, 2018 11:52 am

mcmc model stops running

Post by med151991 »

Hello,

So my code worked with running this

Code: Select all

model<-log(death)~1+gender+education+parentdeath+offset(log(personyears))+(1|region)+(1|household)
model1<-runMLwiN(Formula=model, D="Poisson", data=dataset, estoptions=list(EstM=1))
however, when I add the iterations and burn in, it says 'MLwiN is running please wait' for a while, then just stops completely with no warning messages or any return.

Code: Select all

model<-log(death)~1+gender+offset(log(personyears))+(1|region)+(1|household)
model1<runMLwiN(Formula=model, D="Poisson", data=dataset, estoptions=list(EstM=1), mcmcMeth=list(burnin=500, nchains=2, iterations=2500, thinning=10)))
There are a lot of cases so I am wondering if its too complex, but it work with the first type of mcmc code so I'm not sure
ChrisCharlton
Posts: 1285
Joined: Mon Oct 19, 2009 10:34 am

Re: mcmc model stops running

Post by ChrisCharlton »

When you specify more than one chain in R2MLwiN each estimated chain is sent to a child R process so that they can be run in parallel. This can result in status messages not being sent back to the main R instance for display. You can check whether this is the cause by temporarily changing nchains back to 1 and looking for messages as the model runs. You can also check that the model is set up correctly by adding the debugmode=TRUE options in estoptions. This will cause the model to open in the GUI version of MLwiN, pausing before and after the model fitted.

One possible reason why nothing is returned for your second model is that you have a less than (<), rather than an assignment (<-) on the last line. If this is your actual syntax then anything that comes back from the runMLwiN function will be thrown away.
med151991
Posts: 13
Joined: Tue Dec 11, 2018 11:52 am

Re: mcmc model stops running

Post by med151991 »

Hi Chris,

You are right thank you, i didn't notice that it had finished, I had used multiple chains so that makes sense thank you. The < was a mistake in writing out the code I used. Thanks for your help and quick reply!
Post Reply