I'm new to JAGS and I'm running a model in R via R2jags
package.
The model code is based on a code taken from Kéry & Schaub 2012 ('Bayesian Population Analysis using WinBUGS"), pg 399.
Chi-square discrepancy measure is computed
model {
....
for(g in 1:G) {
for (t in 1:T) {
...
E[g,t] <- pow((y[g,t] - eval[g,t]),2) / eval[g,t]
...
}#t
}#g
fit <- sum(E[,])
}#model
where g
and t
are site and time indices and G
and T
are then the number of sites and the number of years
I get an error though
Error in jags.model(model.file, data = data, inits = init.values, n.chains = n.chains, :
RUNTIME ERROR:
Compilation error on line 140.
Cannot evaluate subset expression for fit
Is it caused by different syntax used by JAGS relative to WinBUGS? The code is the same used in the book, except for I have 2 dimensions instead of three as in the book example.