This seems to be an issue for folks in the Bayesian class I'm teaching.
For the sake of helping the nimble folks track down the internal error, here's an example of what caused it.
One student had this error after running:
prepnim <- nimbleModel(code = CJS_sex_year, constants = constants, dat = data_list,
inits = inits, calculate = T)
and then trying to do:
mcmc_out <- nimbleMCMC(
code = CJS_sex_year,
constants = constants,
data = data_list,
inits = inits,
monitors = params,
niter = 6000,
nburnin = 3000,
nchains = 3,
thin = 1,
samplesAsCodaMCMC = TRUE
)
It seems that sometimes the two forms of running the model clash somehow, even if everything in R is cleared but R is not restarted. Restarting R seems to help.