How can I fix the stepsize in Rstan


I am using Rstan and I am trying to fix the stepsize in sampling. I used warmup = 0 and stepsize = 0.01 now, however when I extracted the sampler parameters, the stepsize was 1 but not 0.01. I am not sure why this happened. Is there a way I can fix the stepsize at a particular value?

Thank you!

When using the default stan sampler (NUTS) you cannot fix the stepsize, since this is determined as part of the adaptation process. When you specify stepsize = 0.01, this just sets the initial value to optimise from.

You generally don’t want a fixed stepsize, as this can dramatically affect your sampling performance. You can nudge Stan to adapt to a smaller stepsize by increasing the adapt_delta argument to be closer to 1, would that be what you’re trying to achieve?

1 Like

Thank you! The situation is that I have run a chain previously and saved the sampling results as well as the tuned stepsize. Now I’d like to continue running the chain from the last sampled value and using the same stepsize as before. So from your answer I think I can’t do this using Rstan…

1 Like

It turns out you need a bit more than stepsize to continue a chain in Stan (notably the adapted mass matrix). If you search this forum for “checkpointing” there was a bunch of discussion on how to let you save state and restart chains, but there is unfortunately no direct support for this from any of the interfaces, but it might get implemented at some point.

1 Like