Build a sampler from transition functions
Defines a probability distribution object for use with
A list of transition functions; see details.
A character string naming the sampler.
A character string naming the sampler in
compounded.sampler builds an MCMC sampler following the
compare.samplers from a list of
transition functions. The returned sampler has four arguments:
target.dist, x0, sample.size, and limit.
Further arguments, including the standard argument tuning,
are passed to every transition function. The first three arguments
transition functions are passed are target.dist, a vector
state x to transition from, and the log density at that
state, y. They should return a list containing four elements:
x, y, evals, and grads. x is the
state transitioned to, y is the log density at that state,
and evals and grads are the number of log density and
gradient calls made in that transition.
Each MCMC iteration, the first transition function is called with the current state of the chain. The state it returns is passed to the second transition function, whose returned state is passed to the third, and so on. The state returned by the final transition function is taken to be the state of the chain as a whole at the end of the iteration.
This way, transition functions that provide complementary features,
such as fast mixing in different coordinates, can be combined
without modifying their internal structure. The
interface provides a similar mechanism for samplers implemented
in C. It is documented in the vignette, “R/C Glue in
A sampler function.
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.