I'd highly suggest to start directly in OpenBUGS (without R):
An opened trap windows means you have generated some BUGS error. Hence
the problem is not on the R side ...
Once you got it to work, you can switch over to R and use WinBUGS more
remotely and embed the stuff in your other R functions.
Best,
Uwe Ligges
On 06.05.2010 14:57, Fabio Valeri wrote:> Hi,
>
> I have a strange behaviour of openBUGS and WinBUGS when I start them
> from R.
>
> Version:
> R: 2.10.1
> openBUGS: 3.07
> WinBUGS: 1.43
> R2WinBUGS: 2.1-16
> BRugs: 0.5-3
>
> I have a model and data without initial start values. If I use the stand
> alone versions of openBUGS and WinBUGS I don't have any problems and I
> get what I want.
>
> If I use function bugs() from R2WinBUGS- resp. BRugs-Library then both
> begin to compute but do not end. If I use a simple model with data and
> initial values bugs() works fine. So, I have to assume that there is
> something in my model which is not compatible with bugs().
>
> The model is:
> -------------------------------------
> model generateStartingValues
> { for (s in 1:Datasets) {
> lambda[s]~dunif(0.1,0.9)
> for (i in 1:K){ eltheta[s,i]~dunif(0.1,0.3)
> q[s,i]~dunif(0.1,0.4) } }
> }
> -------------------------------------
>
> DATA
> list(K=19,Datasets=500)
>
> As I said this works fine with openBUGS and WinBUGS.
>
> I start BUGS from R-Console with
> --------------------------------
> Datasets <- 500
> K <- 19
> data <- list("Datasets","K")
> mod1 <- bugs(data,inits=NULL
> ,model.file="generateStartingValues.bug"
> ,parameters=c("eltheta","q")
> ,n.chains=1, n.iter=1000
> ,bugs.directory="D:/WinBUGS14"
> ,debug=TRUE
> #,program="openbugs"
> )
> --------------------------------
>
> After starting bugs() the WinBUGS-Window has been opened (log- and
> trap-window) and after a long while (10 minuites-trial and one
> hour-trial) it does still compute or what ever. If I close the WinBUGs
> window the R-Console gives:
> ****************************
> Fehler in bugs.run(n.burnin, bugs.directory, WINE = WINE, useWINE >
useWINE, :
> Look at the log file and
> try again with 'debug=TRUE' to figure out what went wrong within
Bugs.
> ****************************
> There is no log-File but I copied the content of the log-window (see
> below).
>
>
> If I start openBUGS from R:
> After about 5 seconds a window appears indicating a
"dwwinn.exe-Error":
> ********************************************
> dwwinn.exe - Fehler in Anwendung
> Die Ausanahme "unknown softare exception" (x800000003) ist in der
> Anwendung an der Stelle 0x7c91120 aufgetreten.
> OK Cancel
> ********************************************
>
> The output on R-Console is
> ***************************************
> model is syntactically correct
> data loaded
> model compiled
> initial value generated, model initialized
> Sampling has been started ...
> ***************************************
>
> To finish I have to close the R-console.
>
> Maybe there is something I missed. I would be very happy if somebody
> could give me a hint. I could use the stand alone versions but working
> with R is so comfortable.
>
> Thank you
>
> Fabio
>
> content of log-Window (WinBUGS)
> *******************************
> display(log)
>
check(C:/DOKUME~1/Fabio/LOKALE~1/Temp/RtmpXILhKP/generateStartingValues.bug.txt)
>
> model is syntactically correct
> data(C:/DOKUME~1/Fabio/LOKALE~1/Temp/RtmpXILhKP/data.txt)
> data loaded
> compile(1)
> model compiled
> gen.inits()
> initial values generated, model initialized
> thin.updater(1)
> update(500)
> set(eltheta)
> set(q)
> set(deviance)
> dic.set()
> cannot calculate DIC for model
> update(500)
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.