winbugs code won't run

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin 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 runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
pierrenadeau
Posts: 11
Joined: Sun Jan 06, 2013 12:57 am

Re: winbugs code won't run

Post by pierrenadeau »

Dear Chris

Thanks for keeping interest in my problem. As previously suggested I contacted John Thompson from Leicester University (author of the winbugsfromstata ado suite) and forwarded all the evidence. He indicated and I quote: "We are currently involved in a complete upgrade of these programs but I can see no reason why the old versions would not work."

As you know I managed to run some Bayesian analyses on WinBUGS (standalone mode) and get plausible results (see attachment) with the attached text files for the model, data and initial values (which include the corrections you suggested). However, I would rather run Bayesian on WinBUGS from within Stata. To that effect, I downloaded from the Leicester University site and installed manually the wbfiles (put them in the appropriate ado folder). However, I cannot produce any results when I run simulations on WinBUGS from Stata despite the fact that simulations run smoothly on WinBUGS in standalone mode (not from within Stata). The coda file is not created by the wbscript command and nothing shows in the data editor. Attached is the output from Stata showing the syntax for the three key wb commands (i.e. wbscript, wbrun, wbcoda) and the WinBUGS log when executing wbscript and wbrun commands from Stata. After all the hours spent on this problem it would be nice to solve it once and for all.

Kind regards
Pierre
WinBUGS 1.4 Results.pdf
(270.11 KiB) Downloaded 567 times
Stata winbugs output 24Jan13.pdf
(20.56 KiB) Downloaded 574 times
winbugsfromstata log.pdf
(32.99 KiB) Downloaded 585 times
ChrisCharlton
Posts: 1353
Joined: Mon Oct 19, 2009 10:34 am

Re: winbugs code won't run

Post by ChrisCharlton »

From the output that you posted it looks like you may need to put quotes around the files referenced by the wbscript options as the path you are using contains spaces.
pierrenadeau
Posts: 11
Joined: Sun Jan 06, 2013 12:57 am

Re: winbugs code won't run

Post by pierrenadeau »

Dear Chris

I put the quotes throughout and ran wbscript, wbrun and wbcoda again. I am getting the same result and error message (see attached).

Kind regards
Pierre
Stata winbugs output 24Jan13 v2.pdf
(20.6 KiB) Downloaded 689 times
ChrisCharlton
Posts: 1353
Joined: Mon Oct 19, 2009 10:34 am

Re: winbugs code won't run

Post by ChrisCharlton »

It looks like you're still getting two data statements in your output:

Code: Select all

data('C:/Documents and Settings/Pierre/My Documents/BIRKBECK/Academic Papers/JOM 2013/Bayesian')
data('ML Estimation/wbd.txt')
Other possibilities I can think of are that the path is too long, or more likely that it doesn't like the + character in the directory name as this is where it is getting split.
pierrenadeau
Posts: 11
Joined: Sun Jan 06, 2013 12:57 am

Re: winbugs code won't run

Post by pierrenadeau »

Dear Chris

I put all WinBUGS files (model, data and initial values) right at the top of my C drive to bypass the whole directory structure and ..... WinBUGS ran right away from within Stata and produced the coda - no questions asked. A good clean up of my file directory structure is long overdue. So many hours lost.

Many thanks for your assistance and your patience. Don't forget to send me you Xmas list.

Kind regards :D

P.S. The only odd thing I noticed in the program log relates to the generation of initial values. The following message appeared: "command#Bugs:gen.inits cannot be executed (is greyed out)". In any event, WinBUGS managed to run successfully and produce meaningful results.
ChrisCharlton
Posts: 1353
Joined: Mon Oct 19, 2009 10:34 am

Re: winbugs code won't run

Post by ChrisCharlton »

I'm glad to hear that you now have this working. I believe that the gen.inits BUGS command is for generating initial values for parameters where the user hasn't specified any. As you have provided initial values for all the parameters in your model this has nothing to do (and the generate initial values button would be disabled if you were using the graphical interface), hence the message that you saw.
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: winbugs code won't run

Post by GeorgeLeckie »

Hi Pierre,

In the Bayesian formulation of multilevel models, the random effects are is essence another set of parameters and also require initial values. Typically when fitting models in WinBUGS you might provide initial values for all the fixed part and random part model parameters but not the random effects. In this case WinBUGs will generate some automatic initial values for the random effects. Essentially it will assign random numbers from a normal distribution with mean zero and variance equal to the initial value you specify for that parameter. Now in your case MLwiN has generate all the WinBUGs files for you and has actually manually specified a starting value for every random effect. This is why WinBUGS did not need to generate any further initial values.

Best wishes

George
pierrenadeau
Posts: 11
Joined: Sun Jan 06, 2013 12:57 am

Re: winbugs code won't run

Post by pierrenadeau »

Dear Chris, George

I may be pushing my luck here but I am always getting an odd trap message (after estimation) on my 64-bit notebook upon exiting WinBUGS which I am not getting when running/exiting WinBUGS on my 32-bit desktop. I attach the WinBUGS trap message for your reference.

Can you suggest a solution?

Kind regards
WinBUGS Trap Message.pdf
(127.39 KiB) Downloaded 578 times
ChrisCharlton
Posts: 1353
Joined: Mon Oct 19, 2009 10:34 am

Re: winbugs code won't run

Post by ChrisCharlton »

You'd probably get the best explanation for cause of this message from the WinBUGS developers, however we have encountered a similar trap message ourself in the past. We found that copying the WinBUGS directory to somewhere other than Program Files (x86) - we chose c:\WinBUGS caused the trap message to stop appearing. The error may be something to do with directory permissions, but we haven't investigated further.
Post Reply