I am new to WinBUGS and I could not get the code below to work. The model is syntactically correct
(it is a hierarchical logit model with random effects), but when I click load data
the error message that appears is expected key word structure
. What does that mean? Can anyone please help me work the code below please?
My data set is bigger, but to simplify the question I am only working here with n=2 (number of groups) and k=5 (number of subjects in each group).
model{
for(i in 1:n){
for(j in 1:k){
yij[i,j] ~ dbern(p[i,j])
logit(p[i,j]) <- alpha + beta*xij[i,j] + ui[i]
}
ui[i] ~ dnorm(0,tau)
}
alpha ~ dnorm(0,0.001)
beta ~ dnorm(0,0.001)
tau ~ dunif(0,100)
}
with data:
list(n=2, k=5, yij=structure(.Data=c(1, 1, 1, 1, 1, 0, 0, 0, 0, 0), .Dim=c(2,5)),
xij = c(0.0494063719, -0.078101264, 0.2748560749, 0.1245743393, -2.531242809, .6849338859, 0.5302062384, 0.7828560148, -0.012341452, 0.5128471157),
ui = c(0.5031197054, 0.5031197054, 0.5031197054, 0.5031197054, 0.5031197054, -2.13785637, -2.13785637, 2.13785637, -2.13785637, -2.13785637))