Is it possible to access the initial values of the particular chain inside of Stan? What I am trying to accomplish is to create a certain approximation in the transformed data block which is then used in the MCMC, where this approximation depends on some of the initial values of the parameters. This mind sound silly but trust me, there is a reason for this. ;)
Another option would be to pass something relevant as a data, and then make appropriate choice based on the ID of the chain, but can I get that kind of ID from Stan?
Currently only options seems to be run separate instances of single-chain Stan, but then I need “manual” parallelization etc.
If you declare CHAIN_ID in the
data block of your Stan program, RStan will pass it. If you are sampling in parallel, you may have to specify
chain_ID = 0 in the call to
sampling, but it will pass the right
chain_ID in each of the subprocesses.
You need to run the exact same model and data in each chain in order to diagnose convergence. Then, if you want to do something else (like deal with multiple imputation), you need to repeat that whole multi-chain operation over the variables that vary by run.
The initial values should have no bearing on how the chain proceeds. If you try to condition on the first iteration (which is a diffuse init for warmup in most cases), you no longer have a Markov chain and all the analysis after that goes out the window.
Thanks I’ll try CHAIN_ID approach.
Yes of course in this case I can’t compare difference chains in usual way, I was just planning to use multiple chain approach as a straightforward way to parallelize some independent computations, as this way some of the post-processing steps are easier. Although I just found out function sflist2stanfit which could be useful as well.