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>