How to make an initial value file for MathematicaStan

Dear All,

Can I see an example of how to make a file with initial values in MathematicaStan that I can use in

StanSetOptionSample[“init”, “initfile”]

Christian Damgaard

Hi @cfd, welcome to the Stan forums.

I don’t know much about MathematicaStan but since it just wraps CmdStan maybe the same file that could be used with CmdStan could be used with MathematicaStan. If that’s the case then hopefully the info from the CmdStan guide about how to format JSON files for use with CmdStan will be helpful:

Thanks Jonah, it works.

Here is the Mathematica code for generating an “initfile” for three parameters and two sampling chains:
Export[“initfile”, {“slope” -> {0, 5}, “sigmap” -> {0.000001, 2}, “delta” -> {0.01, 0.5}}, “JSON”]

I am used to running the Metropolis algorithm and I was surprised that the sampling chains were rather insensitive to the initial values. Is this because the warmup procedure is different from a Metropolis burnin procedure?


1 Like

Yeah I think that’s probably why. The warmup procedure is definitely very different from a Metropolis burnin. If you’re curious about more of the details here’s part of the reference manual that talks about the warmup:

The initial values can definitely matter for certain kinds of tricky models, but for most of the models people fit in Stan (including many very complicated ones) they really don’t matter too much because it is able to find the important regions of the posterior so quickly. So if you’re used to Metropolis this can definitely be surprising! Generally I just use the random inits Stan will automatically generate unless I start running into problems.