Skip to main content Skip to navigation

MCMC in Java

Sherman E. Lo, 2020

Java implementations of the Metropolis-Hastings (Metropolis et al., 1953) (Hastings, 1970), Adaptive Metropolis-Hastings (Haario et al., 2001) (Roberts and Rosenthal, 2009), Hamiltonian Monte Carlo (Neal, 2011), No U-Turn Sampler (Hoffman and Gelman, 2014) including the dual averaging version and Elliptical Slice Sampler (Murray et al., 2010).

Also included are Processing implementations of the algorithms for visualising these algorithms sampling a 2D Normal distribution.

Please visit the GitHub repository .

Screenshots

Brownian Motion

Random Walk Metropolis-Hastings

Hamiltonian Monte Carlo

No U-Turn Sampler

Elliptical Slice Sampler

References

  • Haario, H., Saksman, E., Tamminen, J., et al. (2001). An adaptive Metropolis algorithm. Bernoulli, 7(2):223-242.
  • Hastings, W. K. (1970). Monte Carlo sampling methods using Markov chains and their applications. Biometrika 57(1):97-109.
  • Hoffman, M. D. and Gelman, A. (2014). The No-U-turn sampler: Adaptively setting path lengths in Hamiltonian Monte Carlo. Journal of Machine Learning Research, 15(1):1593-1623.
  • Metropolis, N., Rosenbluth, A. W., Rosenbluth, M. N., Teller, A. H., and Teller, E. (1953). Equation of state calculations by fast computing machines. The Journal of Chemical Physics, 21(6):1087–1092.
  • Murray, I., Adams, R. P., and MacKay, D. J. (2010). Elliptical slice sampling. In Proceedings of the 13th International Conference on Artificial Intelligence and Statistics.
  • Neal, R. M. (2011). MCMC using Hamiltonian dynamics. In Brooks, S., Gelman, A., Jones, G., and Meng, X.-L., editors, Handbook of Markov Chain Monte Carlo, chapter 5, pages 113–162. CRC press.
  • Roberts, G. O. and Rosenthal, J. S. (2009). Examples of adaptive MCMC. Journal of Computational and Graphical Statistics, 18(2):349–367.