[R] OpenBUGS and glmmBUGS package

Shige Song shigesong at gmail.com
Mon Jun 27 12:27:43 CEST 2011


Dear All,

I am trying to use the glmmBUGS package with OpenBUGS under Linux.
Here is a short list of code I modified from the diseasemapping
package document:

----------------------------------------
library(diseasemapping)

data(popdata)
data(casedata)
model = getRates(casedata, popdata, ~age*sex, breaks=seq(0, 90, by=10) )
ontario = getSMR(popdata,model, casedata)

spplot(ontario, 'SMR')

library(spdep)

popDataAdjMat = poly2nb(ontario, ontario[["CSDUID"]])

library(glmmBUGS)

forBugs = glmmBUGS(formula=observed + logExpected ~ 1,
effects="CSDUID", family="poisson", spatial=popDataAdjMat,
data=ontario at data, modelFile="model.txt")

startingValues = forBugs$startingValues

source("getInits.R")

library(R2OpenBUGS)

ontarioResult = bugs(forBugs$ragged, getInits, parameters.to.save =
names(getInits()), model.file="model.txt", n.chain=3, n.iter=100,
n.burnin=10, n.thin=2)
-------------------------------------------

I got error message saying "Error in bugs.run(n.burnin, OpenBUGS.pgm,
debug = debug, WINE = WINE,  :
  Look at the log file in  /tmp/Rtmp0wN6Jy  and
try again with 'debug=TRUE' to figure out what went wrong within OpenBUGS."

I also tried to use the R2WinBUGS package instead of R2OpenBUGS
package with the "program="openbugs"" option, then I got error message
saying "Carriage returns added to model file model.bug
model is syntactically correct
data loaded
Error in handleRes(res) :
  An OpenBUGS module or procedure was called that did not exist.
Please report this bug to Chris Jackson
<chris.jackson at mrc-bsu.cam.ac.uk>"

Thanks for your time.

Best,
Shige



More information about the R-help mailing list