From: Chris Chapman <cnchapman_at_msn.com>

Date: Fri, 27 May 2011 09:38:04 -0700

}

"

print(modelString)

writeLines(modelString,con="model3.txt") modelCheck( "model3.txt" )

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. Received on Fri 27 May 2011 - 19:37:42 GMT

Date: Fri, 27 May 2011 09:38:04 -0700

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.

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 ===

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_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. Received on Fri 27 May 2011 - 19:37:42 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Sun 29 May 2011 - 19:30:10 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*