Hi All, I am trying to figure out how to use R-Coda with the output from OpenBugs. I have installed and loaded the packages BRugs and R2WinBUGS. I have successfully run a simple Bayes model in WinBUGS using R2WinBUGS' "bugs" and have used "read.bugs" to build the coda object. I can successfully switch to OpenBugs and run the same model and get the basic summary back. However, I cannot build the coda object. From what I have read "read.openbugs" should do the trick. However, I have discovered the current version of OpenBUGS (v 3.03) doesn't write any output files in spite of setting codaPkg=TRUE in the "bugs" call. "Str(openbugs.object)" reveals a large collection of elements, one of which is an array that contains the MCMC chains. Is there a function to build the coda object? Thanks in advance for any suggestions, Bill Halteman
Have you tried the rjags package which uses the jags system? It is much more integrated into R and works quite well. It uses the same modeling language as BUGS. It is also better supported than OpenBUGS. Frank Bill Halteman wrote:> Hi All, > > I am trying to figure out how to use R-Coda with the output from > OpenBugs. I have installed and loaded the packages BRugs and R2WinBUGS. > I have successfully run a simple Bayes model in WinBUGS using R2WinBUGS' > "bugs" and have used "read.bugs" to build the coda object. I can > successfully switch to OpenBugs and run the same model and get the basic > summary back. However, I cannot build the coda object. From what I > have read "read.openbugs" should do the trick. However, I have > discovered the current version of OpenBUGS (v 3.03) doesn't write any > output files in spite of setting codaPkg=TRUE in the "bugs" call. > "Str(openbugs.object)" reveals a large collection of elements, one of > which is an array that contains the MCMC chains. Is there a function to > build the coda object? > > Thanks in advance for any suggestions, > > Bill Halteman >-- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University
Bill Halteman wrote:> Hi All, > > I am trying to figure out how to use R-Coda with the output from > OpenBugs. I have installed and loaded the packages BRugs and R2WinBUGS. > I have successfully run a simple Bayes model in WinBUGS using R2WinBUGS' > "bugs" and have used "read.bugs" to build the coda object. I can > successfully switch to OpenBugs and run the same model and get the basic > summary back. However, I cannot build the coda object. From what I > have read "read.openbugs" should do the trick. However, I have > discovered the current version of OpenBUGS (v 3.03) doesn't write any > output files in spite of setting codaPkg=TRUE in the "bugs" call. > "Str(openbugs.object)" reveals a large collection of elements, one of > which is an array that contains the MCMC chains. Is there a function to > build the coda object?For BRugs: Sure, the function is called buildMCMC(). From the examples of ?BRugs: library(BRugs) # loading BRugs ## Now setting the working directory to the examples' one: oldwd <- getwd() setwd(system.file("OpenBUGS", "Examples", package="BRugs")) ## some usual steps (like clicking in WinBUGS): modelCheck("ratsmodel.txt") # check model file modelData("ratsdata.txt") # read data file modelCompile(numChains=2) # compile model with 2 chains modelInits(rep("ratsinits.txt", 2)) # read init data file modelUpdate(1000) # burn in samplesSet(c("alpha0", "alpha")) # alpha0 and alpha should be monitored modelUpdate(1000) # 1000 more iterations .... ## now let's construct a coda object ## (of class mcmc.list, to be precise) ## for BUGS node "alpha": alpha <- buildMCMC("alpha") Best, Uwe Ligges> Thanks in advance for any suggestions, > > Bill Halteman > > ______________________________________________ > 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.
Maybe Matching Threads
- Which JAGS interface to use?
- How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009
- Are they fully identical: WinBUGS and OpenBUGS; R2WinBUGS and R2OpenBUGS
- Error with BRugs 0.53 and 0.71, on Win7 with R 2.12.2 and 2.13.0 (crashes R GUI)
- load coda in BRugs to perfor diagnostics