Question on option "adaptinterval" of slice sampler with subsequent MCMC runs

130 views
Skip to first unread message

Luca

unread,
Sep 24, 2021, 4:34:29 AM9/24/21
to nimble-users
Dear Nimble devs and users,

I was wondering how the "adaptinterval" option (default value is 200) of the slice sampler works under re-running of the Monte Carlo sampler.

Suppose I do a first run (with the slice sampler for some nodes) for 200 iterations. Then another run with the option "reset=FALSE", to begin from where the first run ended. Will the slice sampler be adaptive in this second run? And would it be adaptive if I did the second run with the option "reset=TRUE"?

Thank you very much!
Cordially,
Luca

Daniel Turek

unread,
Sep 24, 2021, 9:13:51 AM9/24/21
to Luca, nimble-users
Great questions, Luca.  Briefly:

"adaptInterval" dictates how often (every how many MCMC sampling iterations) the slice sampler performs it's adaptation routine, in its case updating the "width" of the stepping out procedure performed during slice sampling.  So, by default it adapts the "width" variable every 200 MCMC iterations.

"adapt" dictates whether this adaptation (every adaptInterval MCMC iterations) takes place at all.  adapt=FALSE means the "width"variable will never change from it's current value.

If you do a run with the slice sampler for 200 MCMC iterations, with the default values of adapt=TRUE and adaptInterval=200, then at the very end of the 200th iteration, it will adapt the value of "width".  Starting another MCMC run, with reset=FALSE, means samplers will pick right up where they left off.  So that is using the updated "width" (since it adapted once already), and still using adapt=TRUE and adaptInterval=200.  Those won't change, unless you manually get inside the sampler and change them yourself, which is possible but takes a little know-how.

If you started the second run with reset=TRUE, then still adapt=TRUE, adaptInterval=200, and the "width" will be set back to its original value (by default 1).  So yes, it will again be adaptive.

Other samplers use similar logic for their adaption (e.g. the RW sampler).

Code can be found at:



--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/09d70ed4-603f-b235-fa34-b096d5ffbfbd%40gmail.com.

Luca

unread,
Sep 24, 2021, 9:45:46 AM9/24/21
to db...@williams.edu, nimble-users
Thank you very much, Daniel!

This is great. Then I assume things works similarly for the AF_slice option "sliceAdaptFactorMaxIter". If I set it to, say, 5000, and I do three MCMC runs of 2000 iterations each without reset, then in the middle of the third run the AF_slice will stop adapting the factors.

(I was asking because as far as I understand the samples during adaptation of the AF_slice sampler should not be used, as they are not coming from the eigenvector of the Markov chain.)

Thank you for your always prompt help,
Luca


On 2021-09-24 15:13, Daniel Turek wrote:
> Great questions, Luca.  Briefly:
>
> "adaptInterval" dictates how often (every how many MCMC sampling iterations) the slice sampler performs it's adaptation routine, in its case updating the "width" of the stepping out procedure performed during slice sampling.  So, by default it adapts the "width" variable every 200 MCMC iterations.
>
> "adapt" dictates whether this adaptation (every adaptInterval MCMC iterations) takes place at all.  adapt=FALSE means the "width"variable will never change from it's current value.
>
> If you do a run with the slice sampler for 200 MCMC iterations, with the default values of adapt=TRUE and adaptInterval=200, then at the very end of the 200th iteration, it will adapt the value of "width".  Starting another MCMC run, with reset=FALSE, means samplers will pick right up where they left off.  So that is using the updated "width" (since it adapted once already), and still using adapt=TRUE and adaptInterval=200.  Those won't change, unless you manually get inside the sampler and change them yourself, which is possible but takes a little know-how.
>
> If you started the second run with reset=TRUE, then still adapt=TRUE, adaptInterval=200, and the "width" will be set back to its original value (by default 1).  So yes, it will again be adaptive.
>
> Other samplers use similar logic for their adaption (e.g. the RW sampler).
>
> Code can be found at:
> https://github.com/nimble-dev/nimble/blob/devel/packages/nimble/R/MCMC_samplers.R <https://github.com/nimble-dev/nimble/blob/devel/packages/nimble/R/MCMC_samplers.R>

Daniel Turek

unread,
Sep 24, 2021, 9:58:26 AM9/24/21
to Luca, nimble-users
You're welcome, Luca.  Yes, that's right, the 3x runs each of 2000 iterations will be (from the MCMC's perspective) back-to-back without interruption.  So, you're exactly right, in the middle of the 3rd run (right after the 5000th MCMC iteration) the factors will adapt one more time, and then cease to change thereafter.

Good questions.  Glad that you're exploring the samplers and their functionality.

Cheers,
Daniel

Reply all
Reply to author
Forward
0 new messages