expected variable name error
I have recently started using OpenBUGS and am again frustrated with the lack of helpfulness of the error codes. More importantly, there is a lack of online resources for determining what the error codes mean. Therefore I have decided to start logging my errors and the fixes that I found.
This code:
blog comments powered by Disqus
y <- rbinom(1,10,.5)
library(R2OpenBUGS)
model <- function() {
y ~ dbin(0.5,N)
N ~ dpois(10)
}
fn <- file.path(tempdir(), "model.txt")
write.model(model,fn)
data <- list(y)
inits <- list(list(N=10))
parameters <- c("N")
sim <- bugs(data,inits,parameters,fn,n.chains=1,n.burnin=1,n.thin=1,n.iter=3)
produced the following error in the log file:
OpenBUGS version 3.2.1 rev 781
type 'modelQuit()' to quit
OpenBUGS> model is syntactically correct
OpenBUGS> expected variable name error pos 5 (error on line 1)
OpenBUGS> model compiled
OpenBUGS> OpenBUGS> initial values loaded but chain contain uninitialized variables
OpenBUGS> initial values generated, model initialized
OpenBUGS> 1 updates took 0 s
OpenBUGS> monitor set
OpenBUGS> monitor set
OpenBUGS> monitor set
OpenBUGS> monitor set
OpenBUGS> deviance set
OpenBUGS>
which was due to the line
data <- list(y)
which should have been
data <- list(y=y)
blog comments powered by Disqus