galpy.util.ars.ars

galpy.util.ars.ars(domain, isDomainFinite, abcissae, hx, hpx, nsamples=1, hxparams=(), maxn=100)[source]

Implementation of the Adaptive-Rejection Sampling algorithm by Gilks & Wild (1992): Adaptive Rejection Sampling for Gibbs Sampling, Applied Statistics, 41, 337. Based on Wild & Gilks (1993), Algorithm AS 287: Adaptive Rejection Sampling from Log-concave Density Functions, Applied Statistics, 42, 701

Parameters:
  • domain (list or numpy.ndarray) – [.,.] upper and lower limit to the domain

  • isDomainFinite (list or numpy.ndarray) – [.,.] is there a lower/upper limit to the domain?

  • abcissae (list or numpy.ndarray) – initial list of abcissae (must lie on either side of the peak in hx if the domain is unbounded)

  • hx (function) – function that evaluates h(x) = ln g(x)

  • hpx (function) – function that evaluates hp(x) = d h(x) / d x

  • nsamples (int, optional) – number of desired samples (default=1)

  • hxparams (tuple, optional) – a tuple of parameters for h(x) and h’(x)

  • maxn (int, optional) – maximum number of updates to the hull (default=100)

Returns:

list with nsamples of samples from exp(h(x))

Return type:

list

Notes

  • 2009-05-21 - Written - Bovy (NYU)