My data file looks something like this:
list(y=structure(.Data=c(26, 228, 31, ...)), .Dim=c(413,9))
Let's say this file is saved as "data.txt".
If I'm working in 'R2OpenBUGS', it allows me to pass the data as a file with no problem:
mcmc <- bugs(data = "data.txt", inits=...)
But in JAGS, if I pass data as "data.txt", it says: "data must be a list or environment". What's the problem here? Also, if there is no way around it, is there a way I can read the data as list in R?
My model is:
model {
for (i in 1:413) {
for (j in 1:9) {
logy[i,j] <- log(y[i,j])
logy[i,j] ~ dnorm(m[i], s)
}
}
# priors
for (i in 1:413) {
m[i] ~ dgamma(0.001, 0.001)
}
s ~ dgamma(0.001, 0.001)
}