expected variable name error pos 98349 WInBUGS in R
Hard to help without seeing the actual files. Anyway, this is a BUGS question rather than an R question, because the error comes from the BUGS interpreter. Hence wrong mailing list. Best wishes, Uwe Ligges
Anamika Chaudhuri wrote:
I am using a random intercept model with SITEID as random and NAUSEA as outcome. I tried using a dataset without missing values and changed my model statement accordingly but still get the same error. Follwoing in an excerpt.
anal.data <- read.table("nausea.txt", header=T, sep="\t")
list(names(anal.data))
[[1]] [1] "SITEID" "NAUSEA"
#anal.data <- read.csv("simuldat.csv", header=T)
attach(anal.data)
The following object(s) are masked from anal.data ( position 3 ) :
NAUSEA SITEID
The following object(s) are masked from anal.data ( position 4 ) :
NAUSEA SITEID
data.bugs <-
list("NAUSEA"=NAUSEA,"SITEID"=SITEID,"n.samples"=n.samples,"n.sites"=n.sites,"n.params"=n.params)
bugsData(data.bugs, fileName = "nauseadata.txt")
inits.bugs <- list("alpha"=rep(0,n.sites), "tau"=1)
bugsInits(list(inits.bugs), fileName = "nauseainit.txt")
modelCheck("nausea_random.txt") # check model file
model is syntactically correct
modelData("nauseadata.txt") # read data file
expected variable name error pos 98349
*MODEL*
model
{
for (i in 1:n.samples)
{NAUSEA[i] ~ dbin(p[i],1)
logit(p[i]) <- alpha[SITEID[i]]}
#for(k in 1:n.params)
#{b[k]~ dnorm(0.0,tau)}
for (j in 1:n.sites)
{alpha[j]~dnorm(0.0,1.0E-10)}
tau ~ dgamma(0.001,0.001)
}
*Dataset:*
SITEID NAUSEA
1 0
1 1
1 1
1 0
1 1
1 1
1 0
1 1
1 1
1 1
1 0
1 1
1 0
1 1
1 1
1 1
1 0
1 0
1 0
1 1
-Anamika
[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.