WinBUGS message error: expected keyword structure

I am new to WinBUGS and I could not get the code to work. The model is syntactically correct (this is a hierarchical logit model with random effects), but when I click load data , the expected key word structure error message appears. What does it mean? Can someone please help me execute the code below please? My data set is larger, but to simplify the issue, I only work here with n = 2 (number of groups) and k = 5 (number of items 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)) 
+6
source share
1 answer

xij looks like a matrix in the BUGS model, but you have a vector in the data. This should work:

 list(n=2, k=5, yij=structure(.Data=c(1, 1, 1, 1, 1, 0, 0, 0, 0, 0), .Dim=c(2,5)), xij = structure(.Data=c(0.0494063719, -0.078101264, 0.2748560749, 0.1245743393, -2.531242809, .6849338859, 0.5302062384, 0.7828560148, -0.012341452, 0.5128471157), .Dim=c(2,5)), ui = c(0.5031197054, 0.5031197054, 0.5031197054, 0.5031197054, 0.5031197054, -2.13785637, -2.13785637, 2.13785637, -2.13785637, -2.13785637)) 
+4
source

All Articles