I received the following error when setting up my JAGS model:
Error in jags.model("model.txt", data = jagsdata, n.chains = 4, n.adapt = 1000)
:
RUNTIME ERROR:
Compilation error on line 4.
Cannot evaluate upper index of counter i
I’d previously pasted the following code which corresponded to line 4 of the model:
for (i in 1:length(Y)) {
The problem was that I’d changed the case of my actual data so that the y was meant to be lower case.
for (i in 1:length(y)) {
The moral of the story: when pasting code from previous examples, make sure all the variable names are updated properly.