I am trying to sample from prior distributions and constrain some of the sums and differences to be greater than 0, however, when I run this code that usually works in OpenBugs/WinBugs, I get the following error 'Attempt to redefine node '. I was wondering if there is any possible way to define my constraints in order to prevent this error from occurring. Any help would be massively appreciated.
Thanks
S[1,1] ~ dbeta(8.10, 32.81)
d[1,1] ~ dbeta(4.36, 32.61)
d[1,2] ~ dnorm(0.097, 250)
d[2,2] ~ dbeta(2.23, 20.10)
Z1 <- 1
Z1 ~ dbern(constraint)
#Constraints
constraint <- step(S[1,1] + d[1,2])*
step(1 - S[1,1] - d[1,2])*
step(S[1,1] - d[1,1])*
step(S[1,1] + d[1,2] - d[2,2])
One way would be to define
Z1
as 1 in the data and take it out of the model. Then, you can leave in theZ1~dbern(constraint)
in the model.