[R-sig-ME] Making glmmBUGS work with JAGS

Shige Song shigesong at gmail.com
Sun Jun 20 14:17:36 CEST 2010


Dear All,

I wonder if anybody has tried to make glmmBUGS work with JAGS. My
attempt was not successful.

Here is the simple example I copied from the glmmBUGS Vignettes:

------------------------
library(MASS)
data(bacteria)

bacterianew <- bacteria
bacterianew$yInt = as.integer(bacterianew$y == "y")

levels(bacterianew$trt) <- c("placebo", "drug", "drugplus")

library(glmmBUGS)

bacrag <- glmmBUGS(formula = yInt ~ trt + week, data=bacterianew,
effects = "ID",
                   modelFile="model.bug", family="bernoulli")

names(bacrag$ragged)

source("getInits.R")

startingValues = bacrag$startingValues
------------------------

With WinBUGS, it runs well:

------------------------
library(R2WinBUGS)

bacResult1 = bugs(bacrag$ragged, getInits, model.file="model.bug", n.chain=3,
  n.iter=2000, n.burnin=100, parameters=names(getInits()), n.thin=10)
------------------------

But with JAGS, I got error message "Error in FUN(50L[[1L]], ...) :
invalid first argument"

------------------------
library(R2jags)

jags.parms=names(getInits())

bacResult = jags(data=bacrag$ragged, n.chain=3, n.iter=2000,
model.file=model.bug)
------------------------

I hope somebody can help me figuring out how to make this work. Many thanks.

Best,
Shige




More information about the R-sig-mixed-models mailing list