Hello everyone. I am pretty new at bayesian inference, stan, and I do not know every feature of the stan. When I worked with large models, run time can be excessively long for higher iterations. So, I want to start with a small iteration and resume to sample if chains do not mix. Is it possible in stan and if it is, how? Currently, I am working with R. I will be appreciated if you could help me.
Based on a thread from several years ago, you can continue sampling in cmdstan. I don’t know whether it is possible with rstan.
You can also restart with cmdstanr (painful due to lack of structured extract, but you can bring in RStan to do the extracting) and more easily with CmdStanPy.
The main drawback to restarting sampling is that you may need more warmup iterations. So what I’ve done in the past is start with something like 100 warmup, 100 sampling iterations, then keep doubling both those and re-running until you hit target ESS. You can workout that this requires at most double the work that would be required to just restart.
If using cmdstanR, @Raoul-Kima just posted some helpful R code for resuming.
Is that a typo? Maybe you meant “the main drawback to not restarting sampling”?
Sorry it wasn’t clear. By “sampling”, I mean the sampling stage of our two stage process consisting of warmup followed by sampling. I meant there can be problems if you just restart sampling and don’t run more warmup.
Really? Even if you have the mass matrix, step size & init from the last sample?
Let me try to be more clear. If warmup has converged (in terms of step size and metric estimates), then by all means restart sampling. If warmup hasn’t converged, it’s better to restart with more warmup before more sampling because sampling tends to be inefficient before warmup has converged.