Daniel Eaton Adaptive Rejection Sampling in Matlab 

For a course in statistical computation, I implemented Gilks and Wild's algorithm "Adaptive Rejection Sampling" (ARS), W. Gilks and P. Wild, Adaptive rejection sampling for Gibbs sampling. Applied Statistics, 1992 (PDF version). It's a neat algorithm to sample exactly (all accepted samples are iid) and efficiently from any univariate log-concave distribution. In fact, it can also be used to sample from joint multivariate log-concave distributions (conditionally, see paper) as well, or, even as a proposal for the Metropolis-Hastings algorithm for any univariate target (Gilks, W. R., Best, N. G. and Tan, K. K. C. Adaptive rejection Metropolis sampling. Applied Statistics, 44, 455-472, 1995). As in ordinary rejection sampling, the target distribution need not be normalized.

Needless to say, ARS is quite useful, especially for doing Gibbs sampling, where many 1D log-concave distributions can typically crop up.

ARS function, including a demo: ars.zip (recommended)
ARS function only: ars.m

Back to my main page.