Dear R-users,

I am trying to use the following code to reproduce results from Prof.
Gelman's book, but have the listed error for R2WinBUGS version (the openbugs
version is good). I am using R-2.6.1 on windows XP, and all the R packages
are most current ones. schools.bug can be found at
http://www.stat.columbia.edu/~gelman/bugsR/runningbugs.html . Can anyone
help me to figure out what's going wrong?


rm(list=ls())
library(R2WinBUGS)
library ('BRugs')
setwd('C:/bayesian/bda/codes/example_5_5')
data(schools)
J <- nrow(schools)
y <- schools$estimate
sigma.y <- schools$sd
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.sim <- bugs(data, inits, parameters, model.file='schools.bug',
                    n.chains=3, n.iter=1000, clearWD=TRUE)
## schools.sim <- bugs(data, inits, parameters, model.file='schools.bug',
##                     n.chains=3, n.iter=1000, clearWD=TRUE,
##                     program = 'openbugs')
print(schools.sim)
plot(schools.sim)



Error in matrix(unlist(mx), ncol = n.cols, byrow = TRUE) :
  invalid 'nrow' value (too large or NA)



Thanks

	[[alternative HTML version deleted]]

