Beware: MCMC sampling can be dangerous!
This function creates a unuran
object based on the
Hit-and-Run algorithm in combinaton with the Ratio-of-Uniforms method
(‘HITRO’).
It can be used to draw samples of a continuous random vector with
given probability density function using ur
.
The algorithm works best with log-concave distributions. Other
distributions work as well but convergence can be slower.
The density must be provided by a function pdf
which must
return non-negative numbers and but need not be normalized (i.e., it
can be any multiple of a density function).
The center
is used as starting point of the Hit-and-Run
algorithm. It is thus important, that the center
is contained
in the (interior of the) domain.
Alternatively, one could provide the location of the
mode
. However, this requires its exact position whereas
center
allows any point in the “typical” region of the
distribution.
If the mode
is given, then it is used to obtain an upper bound
on the pdf
and thus its location should be given sufficiently
accurate.
The ‘HITRO’ algorithm is a MCMC samplers and thus it does not produce a
sequence of independent variates. The drawn sample follows the target
distribution only approximately.
The dependence between consecutive vectors can be decreased when
only a subsequence is returned (and the other elements are erased).
This is called “thinning” of the Markov chain and can be
controlled by the thinning
factor. A thinning factor \(k\)
means that only every \(k\)-th element is returned.
Markov chains also depend on the chosen starting point (i.e., the
center
in this implementation of the algorithm).
This dependence can be decreased by erasing the first
part of the chain. This is called the “burn-in” of the Markov
chain and its length is controlled by the argument burnin
.