If it worked the first 255 times of your loop, then there is probably nothing wrong with your syntax. But you need to be very careful to not reload the compiled Stan model more than once by compiling it once outside the loop with stan_model
and then inside the loop with sampling
rather than stan
.
1 Like