I am using stan_glmer to fit a mixed-effect model. I noticed that when one of the four chains failed to initialise, the other three chains initialised fine and kept sampling. As a result, when the model finished sampling, I had samples from the three chains, not four chains.
Is there any way to stop the sampling altogether when some of the chains fail to initialise? The error message here is “Error in sampler$call_sampler(args_list[[i]]) : Initialization failed.”
Ideally, I would like to stop all the chains when some of the chains do not initialise, tweak “init_r”, and start all the chains again. Here, I am not using stan_glmer in an interactive session, and so, it helps a lot if I can programmatically catch the error.
- Operating System: Debian on Docker
- rstanarm Version: 2.18.2