I run properly the following model in OpenBUGS and JAGS but when I move to runjags, it gives me an error
model{
for (i in 1 : Nsubj){
for (j in 2: 5){
ptemp[i, j] <- exp(beta[1]+ beta[2]Age[i] +beta[3]Y[i, j-1])/(1+exp(beta[1]+ beta[2]Age[i] +beta[3]Y[i, j-1]))
The error you quote is coming from JAGS rather than runjags, and at a guess is related to the initial values and data you are trying to use (although I can't tell as you have not included these in your post). If you are supplying Age as data, then make sure you don't have any initial values set for this.
If that isn't the problem can you post a minimal reproducible example so I can try and help further?
Also, there is a formatting error in your post - I assume line 4 of the model should read:
Hi all,
I run properly the following model in OpenBUGS and JAGS but when I move to runjags, it gives me an error
model{
for (i in 1 : Nsubj){
for (j in 2: 5){
ptemp[i, j] <- exp(beta[1]+ beta[2]Age[i] +beta[3]Y[i, j-1])/(1+exp(beta[1]+ beta[2]Age[i] +beta[3]Y[i, j-1]))
}
ERROR: Error in node Age[1]
Cannot overwrite value of observed node.
Do anyone know why it is in runjags?
Thank you!
Tran.
Last edit: Trung Dung Tran 2016-08-22
Hi Tran
The error you quote is coming from JAGS rather than runjags, and at a guess is related to the initial values and data you are trying to use (although I can't tell as you have not included these in your post). If you are supplying Age as data, then make sure you don't have any initial values set for this.
If that isn't the problem can you post a minimal reproducible example so I can try and help further?
Also, there is a formatting error in your post - I assume line 4 of the model should read:
[By the way, there is also an inverse logit (ilogit) function in JAGS.]
Hope that helps,
Matt