Skip to main content
. 2024 Aug 5;3:204. Originally published 2023 Nov 20. [Version 3] doi: 10.12688/openreseurope.16679.3

Figure 2. Flowchart and pseudocode showing the main steps in the Metropolis-Hastings algorithm.

Figure 2.

In the pseudocode, the total number of MCMC steps and the sampling frequency j are defined by the user, whereas the Hastings ratio R is calculated from the posterior distribution. See Figure 1 for a full description of the Hastings ratio.