adapt: Adaptive phase for JAGS models

Description Usage Arguments Details Value Author(s)

View source: R/jags.object.R


Update the model in adaptive mode.


adapt(object, n.iter, end.adaptation=FALSE, ...)



a jags model object


length of the adaptive phase


logical flag. If TRUE then adaptive mode will be turned off on exit.


additional arguments to the update method


This function is not normally called by the user. It is called by the jags.model function when the model object is created.

When a JAGS model is compiled, it may require an initial sampling phase during which the samplers adapt their behaviour to maximize their efficiency (e.g. a Metropolis-Hastings random walk algorithm may change its step size). The sequence of samples generated during this adaptive phase is not a Markov chain, and therefore may not be used for posterior inference on the model.

The adapt function updates the model for n.iter iterations in adaptive mode. Then each sampler reports whether it has acheived optimal performance (e.g. whether the rejection rate of a Metropolis-Hasting sampler is close to the theoretical optimum). If any sampler reports failure of this test then adapt returns FALSE.

If end.adaptation = TRUE, then adaptive mode is turned off on exit, and further calls to adapt() do nothing. The model may be maintained in adaptive mode with the default option end.adaptation = FALSE so that successive calls to adapt() may be made until adaptation is satisfactory.


Returns TRUE if all the samplers in the model have successfully adapted their behaviour to optimum performance and FALSE otherwise.


Martyn Plummer

rjags documentation built on Nov. 6, 2019, 5:07 p.m.