-2
$\begingroup$

I have studied many books and tried to understand both the Metropolis and Metropolis-Hastings algorithm. Everywhere it is written in the context of the Ising model or Lenard-Jones Energy. I am having difficulty understanding the algorithm from this context.

Can you give an example without using the context of Physics/Mechanics/Dynamics?

A source code example would be much appreciated.

$\endgroup$

1 Answer 1

2
$\begingroup$

I'm not sure what books you have read, but I personally enjoyed both the explanatory approaches of Ben Lambert (A Student’s Guide to Bayesian Statistics) and Richard McElreath (Statistical Rethinking A Bayesian Course with Examples in R and STAN). McElreath even provides a source code example of the Metropolis algorithm and HMC in R.

$\endgroup$
1
  • 1
    $\begingroup$ (+1) Yes, McElreath sets Metropolis Hastings within the Bayesian modelling setting and hence in a much broader setting than Physics. So do our Monte Carlo books. $\endgroup$
    – Xi'an
    Apr 19, 2022 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.