[R] Openbugs and rbugs on mac with wine

Corey Sparks corey.sparks at utsa.edu
Thu Jan 13 03:33:29 CET 2011


Hello list,
I’ve been trying to get OpenBUGS running on my mac using the wine  
emulator.  I can run Openbugs just fine by doing:
wine ~/OpenBUGS312/OpenBUGS.exe

In the terminal, so OpenBUGS works.  When I try to run the schools  
example using rbugs(), the OpenBUGS process starts in wine, but it  
just sits there, no log, no script, no output of any sort.  The rbugs 
() call makes the init, data, model and script file, but there seems  
to be a problem with R piping the script to OpenBUGS, here is my example

library(rbugs)
data(schools)
J <- nrow(schools)
y <- schools$estimate
y <- rnorm(length(y))
sigma.y <- schools$sd
schools.data <- list ("J", "y", "sigma.y")
## schools.data <- list(J=J, y=y, sigma.y=sigma.y)
inits <- function() {list (theta=rnorm(J,0,100),
                            mu.theta=rnorm(1,0,100),
                            sigma.theta=runif(1,0,100))}
parameters <- c("theta", "mu.theta", "sigma.theta")
schools.bug <- file.path(.path.package("rbugs"), "bugs/model",  
"schools.bug")
file.show(schools.bug)

#This almost runs, it makes all files, but doesn't run the script
schools.sim <- rbugs(data=schools.data, inits, parameters,
                      schools.bug, n.chains=3, n.iter=10000,seed=123,
                      workingDir="/Users/ozd504/Documents/",
                      bugsWorkingDir="/Users/ozd504/Documents/",
                      useWine=TRUE,
                      wine="/opt/local/bin/wine",
                      bugs = "/Users/ozd504/OpenBUGS312/ 
OpenBUGS.exe",OpenBugs=T,
                      debug=TRUE)

This Returns an error saying that bugs terminated before the coda  
could be written

I can also send a screen shot of what happens if anyone is  
interested.  Any help would be most appreciated.  Here is my  
sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] R2WinBUGS_2.1-16 coda_0.14-2      lattice_0.19-13  rbugs_0.4-9

loaded via a namespace (and not attached):
[1] grid_2.12.1  tools_2.12.1


Thanks,
Corey

Corey Sparks
Assistant Professor
Department of Demography and Organization Studies
University of Texas at San Antonio
501 West Durango Blvd
Monterey Building 2.270C
San Antonio, TX 78207
210-458-3166
corey.sparks 'at' utsa.edu



More information about the R-help mailing list