Skip to content
Prev 243707 / 398502 Next

how to update a bugs-model from inside R using R2WinBUGS

I found a very simple way:
you start winbugs from R and state: debug=TRUE, start maybe with few
iterations, like 10.
If everything goes fine, open a new & empty "odc" document in winbugs. Now
scan the log file and find something like this:

update(10)
coda(*,C:/DOKUME~1/Frederic/LOKALE~1/Temp/Rtmp0Ey62L/coda)
stats(*)
history(*,C:/DOKUME~1/Frederic/LOKALE~1/Temp/Rtmp0Ey62L/history.odc)
save(C:/DOKUME~1/Frederic/LOKALE~1/Temp/Rtmp0Ey62L/log.odc)
save(C:/DOKUME~1/Frederic/LOKALE~1/Temp/Rtmp0Ey62L/log.txt)

copy all the lines (found in this order but interrupted by output) into the
new document.
Then start the document as script (model-> script). The only important
thing, however, is only the line "coda...", the update() can be filled with
howmany iterations you like.
On you go and, when you close winbugs, all the output should be read in by
R2winbugs into the R-object you indicated.

Frederic