[1] "Error in sampler$call_sampler(args_list[[i]]) : "
[2] " c++ exception (unknown reason)"
error occurred during calling the sampler; sampling not done
I found this, which seemed to suggest the error could be within the negative binomial function. But the suggested fix doesn’t appear to work for me. Any thoughts?
Hi Ian. I’m unfamiliar with rStan but just by your description alone I assume the problem arises when you’re trying to compile the Stan model. Have you come across this by any chance:
Also, just to confirm, did you save the model in “sir_negbin.stan” as suggested in the source and then had the problem when you run the lines below?
model <- stan_model("sir_negbin.stan")
fit_sir_negbin <- sampling(model,
data = data_sir,
iter = niter,
chains = 4)
I’ve solved the issue, in case anybody runs into this in the future.
I can’t believe I didn’t try this earlier, but I hadn’t installed the latest release of R (version 4.0.2 ). I did that and reinstalled rstan, and now everything is working.