The model is syntactically correct, I loaded the data but when I compile, I get this error : "multiple definitions of node z". I don't know how to solve it
model{
...
for(i in 1:r){
for(j in 1:r){
z[i,j] <- ((step(x[i,j]-0)*1) + (1-step(x[i,j]-0)*(-1)))/2
}
}
# (zij +1)/2
for (j in 1:r) {
for (i in 1:r) {
z[i, j] ~ dbern(p[j])
}
}
...
}
Some help would be appreciated.
You have defined multiple parts if z twice. BUGS does not allow you to overwrite z (or any other node) in the same model, i.e. you can only write one of z~ or z<- once.