Hey there!

I’m wondering if people could help me out a bit with a problem we’re having. Essentially we can sample our model quite well, usually after the first 5-10 iterations. There are a few numerical issues at the start due to our initialization point being a little clumsy.

The thing we want to do is basically to start the MLE/MAP from an interior point in sampling. We have a ton of parameters so we can’t do this init = list(alpha = 0.5, beta=2.0) syntax that doesn’t seem to scale well.

Does anyone have a good technique for extracting a ready-to-go initialization list from a chain or an MLE/MAP result?

In general I find that it’s frustrating to take anything that is an output from Stan and use it as an input elsewhere, in large part because the conventions between input and output differ.

For example, an initialization for vector variables might look like

init = list(means = c(5, 10, 122))

whereas the output (when converted using posterior or chain$draws(format="list")) ends up being something like

list (
  `means[1]` = 5,
  `means[2]` = 6,
  `means[3]` = 15,

Not sure how many people deal with something similar. Any advice is appreciated!

This is possible in cmdstanpy, I believe there is an ongoing discussion for cmdstanr here: Ability to convert a draw of parameters into something compatible with the init arg · Issue #776 · stan-dev/cmdstanr · GitHub