I've run into persistent problems with OpenBUGS crashing when using
BRugs .53 and .71, and am hoping someone has suggestions. There is
obviously something unusual going on in my environment, but I'm at a
loss as to where to begin to try to solve it.
In a nutshell, what happens is that, as soon as I call "modelCheck()"
in BRugs, it gets an error or crashes ... but only some of the time
(90%< p< 100%). Following are details:
1. OpenBUGS 3.0.3 + BRugs 0.531:
It works occasionally, but approximately 90% of the time, I get the
following error from modelCheck():
Error in handleRes(res[[3]]) :
An OpenBUGS module or procedure was called that did not exist.
The specific code seems not to matter, but here is an example (model
taken from the OpenBUGS tutorial):
modelString =
" model
{
for (i in 1:N) {
r[i] ~ dbin(p[i], n[i])
b[i] ~ dnorm(0, tau)
logit(p[i])<- alpha0 + alpha1 * x1[i] + alpha2 * x2[i]
+ alpha12 * x1[i] * x2[i] + b[i]
}
alpha0 ~ dnorm(0, 1.0E-6)
alpha1 ~ dnorm(0, 1.0E-6)
alpha2 ~ dnorm(0, 1.0E-6)
alpha12 ~ dnorm(0, 1.0E-6)
tau ~ dgamma(0.001, 0.001)
sigma<- 1 / sqrt(tau)
}
"
print(modelString)
writeLines(modelString,con="model3.txt")
modelCheck( "model3.txt" )
Which (usually) produces:
modelCheck( "model3.txt" )
Error in handleRes(res[[3]]) :
An OpenBUGS module or procedure was called that did not exist.
I've copied at the end of this message an example from a single R
session that shows how it may work sometimes but not others.
2. OpenBUGS 3.2.1 + BRugs 0.71:
As above, the model occasionally works, but mostly it crashes R on
the modelCheck() line with the error "R for Windows GUI front-end has
stopped working".
I've tried the following combinations to try to get it to work:
A. Win7 32-bit + R 2.13 + BRugs 0.531 from standard CRAN repository
(installed from R)
B. Win7 32-bit + R 2.13 + BRugs 0.71 + OpenBUGS 3.2.1 (package and
EXE from OpenBUGS site)
C. Win7 64-bit [different machine] + R 2.13 (32-bit) + BRugs 0.531
D. Win7 64-bit + R 2.13 (32-bit) + BRugs 0.71 + OpenBugs 3.2.1
E. Win7 32-bit + *R 2.12.2* + BRugs 0.531 from standard CRAN
repository (installed from R)
F. Win7 64-bit + R 2.12.2 (32-bit) + BRugs 0.531
G. Win7 64-bit + R 2.12.2 (32-bit) + BRugs 0.71 + OpenBugs 3.2.1
H. ... and various combinations of removing all R and openbugs
versions, clean installs, and trying again
In all cases, it occasionally works -- especially on first re-install
of the package -- but then generally gives the "handleRes" error with
BRugs 0.531 or crashes with BRugs 0.71.
Thanks in advance for any suggestions!
=== example from a a single R session ===
R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
Loading required package: proto
Loading required package: grid
Loading required package: reshape
Loading required package: plyr
Attaching package: 'reshape'
The following object(s) are masked from 'package:plyr':
rename, round_any
[Previously saved workspace restored]
install.packages("BRugs")
Installing package(s) into 'C:/Users/cchap/Documents/R/win-library/2.13'
(as 'lib' is unspecified)
--- Please select a CRAN mirror for use in this session ---
also installing the dependency 'coda'
trying URL
'http://cran.fhcrc.org/bin/windows/contrib/2.13/coda_0.14-4.zip'
Content type 'application/zip' length 200622 bytes (195 Kb)
opened URL
downloaded 195 Kb
trying URL
'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.13/BRugs_0.5-3.1.zip'
Content type 'application/zip' length 5613828 bytes (5.4 Mb)
opened URL
downloaded 5.4 Mb
package 'coda' successfully unpacked and MD5 sums checked
package 'BRugs' successfully unpacked and MD5 sums checked
The downloaded packages are in
C:\Users\cchap\AppData\Local\Temp\RtmpoNcfyf\downloaded_packages
library(BRugs)
Loading required package: coda
Loading required package: lattice
Welcome to BRugs running on OpenBUGS version 3.0.3
# Specify the model in BUGS language, but save it as a string in R:
modelString = "
+ model {
+ for ( i in 1:nFlips ) {
+ y[i] ~ dbern( theta )
+ }
+ theta ~ dunif( priorA , priorB )
+ priorA<- 0.6
+ priorB<- 1.0
+ }
+ " # close quote to end modelString
# Write the modelString to a file, using R commands:
writeLines(modelString,con="model3.txt")
# Use BRugs to send the model.txt file to BUGS, which checks the
model syntax:
modelCheck( "model3.txt" )
model is syntactically correct
[ . run the model successfully!! .]
[ . now change just the prior definition and try to re-run .]
modelString = "
+ model {
+ for ( i in 1:nFlips ) {
+ y[i] ~ dbern( theta )
+ }
+ theta ~ dunif( priorA , priorB )
+ priorA<- 0.4
+ priorB<- 0.6
+ }
+ " # close quote to end modelString
# Write the modelString to a file, using R commands:
writeLines(modelString,con="model3.txt")
# Use BRugs to send the model.txt file to BUGS, which checks the
model syntax:
modelCheck( "model3.txt" )
Error in handleRes(res[[3]]) :
An OpenBUGS module or procedure was called that did not exist.
[[alternative HTML version deleted]]
______________________________________________
R-help@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.