Understanding the Hastings Algorithm

The Hastings algorithm is a key tool in computational science. While mathematically justified by detailed balance, it can be conceptually difficult to grasp. Here, we present two complementary and intuitive ways to derive and understand the algorithm. In our framework, it is straightforward to see that the celebrated Metropolis–Hastings algorithm has the highest acceptance probability of all Hastings algorithms.