# Metropolis–Hastings algorithm

__: Monte Carlo algorithm__

**Short description**In statistics and statistical physics, the **Metropolis–Hastings algorithm** is a Markov chain Monte Carlo (MCMC) method for obtaining a sequence of random samples from a probability distribution from which direct sampling is difficult. This sequence can be used to approximate the distribution (e.g. to generate a histogram) or to compute an integral (e.g. an expected value). Metropolis–Hastings and other MCMC algorithms are generally used for sampling from multi-dimensional distributions, especially when the number of dimensions is high. For single-dimensional distributions, there are usually other methods (e.g. adaptive rejection sampling) that can directly return independent samples from the distribution, and these are free from the problem of autocorrelated samples that is inherent in MCMC methods.

## History

The algorithm is named in part for Nicholas Metropolis, the first coauthor of a 1953 paper, entitled *Equation of State Calculations by Fast Computing Machines*, with Arianna W. Rosenbluth, Marshall Rosenbluth, Augusta H. Teller and Edward Teller. For many years the algorithm was known simply as the *Metropolis algorithm*.^{[1]}^{[2]} The paper proposed the algorithm for the case of symmetrical proposal distributions, but in 1970, W.K. Hastings extended it to the more general case.^{[3]} The generalized method was eventually identified by both names, although the first use of the term "Metropolis-Hastings algorithm" is unclear.

Some controversy exists with regard to credit for development of the Metropolis algorithm. Metropolis, who was familiar with the computational aspects of the method, had coined the term "Monte Carlo" in an earlier article with Stanisław Ulam, and led the group in the Theoretical Division that designed and built the MANIAC I computer used in the experiments in 1952. However, prior to 2003 there was no detailed account of the algorithm's development. Shortly before his death, Marshall Rosenbluth attended a 2003 conference at LANL marking the 50th anniversary of the 1953 publication. At this conference, Rosenbluth described the algorithm and its development in a presentation titled "Genesis of the Monte Carlo Algorithm for Statistical Mechanics".^{[4]} Further historical clarification is made by Gubernatis in a 2005 journal article^{[5]} recounting the 50th anniversary conference. Rosenbluth makes it clear that he and his wife Arianna did the work, and that Metropolis played no role in the development other than providing computer time.

This contradicts an account by Edward Teller, who states in his memoirs that the five authors of the 1953 article worked together for "days (and nights)".^{[6]} In contrast, the detailed account by Rosenbluth credits Teller with a crucial but early suggestion to "take advantage of statistical mechanics and take ensemble averages instead of following detailed kinematics". This, says Rosenbluth, started him thinking about the generalized Monte Carlo approach – a topic which he says he had discussed often with John Von Neumann. Arianna Rosenbluth recounted (to Gubernatis in 2003) that Augusta Teller started the computer work, but that Arianna herself took it over and wrote the code from scratch. In an oral history recorded shortly before his death,^{[7]} Rosenbluth again credits Teller with posing the original problem, himself with solving it, and Arianna with programming the computer.

## Intuition

The Metropolis–Hastings algorithm can draw samples from any probability distribution with probability density [math]\displaystyle{ P(x) }[/math], provided that we know a function [math]\displaystyle{ f(x) }[/math] proportional to the density [math]\displaystyle{ P }[/math] and the values of [math]\displaystyle{ f(x) }[/math] can be calculated. The requirement that [math]\displaystyle{ f(x) }[/math] must only be proportional to the density, rather than exactly equal to it, makes the Metropolis–Hastings algorithm particularly useful, because calculating the necessary normalization factor is often extremely difficult in practice.

The Metropolis–Hastings algorithm generates a sequence of sample values in such a way that, as more and more sample values are produced, the distribution of values more closely approximates the desired distribution. These sample values are produced iteratively, with the distribution of the next sample being dependent only on the current sample value, thus making the sequence of samples into a Markov chain. Specifically, at each iteration, the algorithm picks a candidate for the next sample value based on the current sample value. Then, with some probability, the candidate is either accepted, in which case the candidate value is used in the next iteration, or it is rejected in which case the candidate value is discarded, and current value is reused in the next iteration. The probability of acceptance is determined by comparing the values of the function [math]\displaystyle{ f(x) }[/math] of the current and candidate sample values with respect to the desired distribution.

For the purpose of illustration, the Metropolis algorithm, a special case of the Metropolis–Hastings algorithm where the proposal function is symmetric, is described below.

- Metropolis algorithm (symmetric proposal distribution)

Let [math]\displaystyle{ f(x) }[/math] be a function that is proportional to the desired probability density function [math]\displaystyle{ P(x) }[/math] (a.k.a. a target distribution)^{[lower-alpha 1]}.

- Initialization: Choose an arbitrary point [math]\displaystyle{ x_t }[/math] to be the first observation in the sample and choose an arbitrary probability density [math]\displaystyle{ g(x\mid y) }[/math] (sometimes written [math]\displaystyle{ Q(x\mid y) }[/math]) that suggests a candidate for the next sample value [math]\displaystyle{ x }[/math], given the previous sample value [math]\displaystyle{ y }[/math]. In this section, [math]\displaystyle{ g }[/math] is assumed to be symmetric; in other words, it must satisfy [math]\displaystyle{ g(x\mid y) = g(y\mid x) }[/math]. A usual choice is to let [math]\displaystyle{ g(x\mid y) }[/math] be a Gaussian distribution centered at [math]\displaystyle{ y }[/math], so that points closer to [math]\displaystyle{ y }[/math] are more likely to be visited next, making the sequence of samples into a random walk
^{[lower-alpha 2]}. The function [math]\displaystyle{ g }[/math] is referred to as the*proposal density*or*jumping distribution*. - For each iteration
*t*:*Generate*a candidate [math]\displaystyle{ x' }[/math] for the next sample by picking from the distribution [math]\displaystyle{ g(x'\mid x_t) }[/math].*Calculate*the*acceptance ratio*[math]\displaystyle{ \alpha = f(x')/f(x_t) }[/math], which will be used to decide whether to accept or reject the candidate^{[lower-alpha 3]}. Because*f*is proportional to the density of*P*, we have that [math]\displaystyle{ \alpha = f(x')/f(x_t) = P(x')/P(x_t) }[/math].*Accept or reject*:- Generate a uniform random number [math]\displaystyle{ u \in [0, 1] }[/math].
- If [math]\displaystyle{ u \le \alpha }[/math], then
*accept*the candidate by setting [math]\displaystyle{ x_{t+1} = x' }[/math], - If [math]\displaystyle{ u \gt \alpha }[/math], then
*reject*the candidate and set [math]\displaystyle{ x_{t+1} = x_t }[/math] instead.

This algorithm proceeds by randomly attempting to move about the sample space, sometimes accepting the moves and sometimes remaining in place. Note that the acceptance ratio [math]\displaystyle{ \alpha }[/math] indicates how probable the new proposed sample is with respect to the current sample, according to the distribution whose density is [math]\displaystyle{ P(x) }[/math]. If we attempt to move to a point that is more probable than the existing point (i.e. a point in a higher-density region of [math]\displaystyle{ P(x) }[/math] corresponding to an [math]\displaystyle{ \alpha \gt 1 \ge u }[/math]), we will always accept the move. However, if we attempt to move to a less probable point, we will sometimes reject the move, and the larger the relative drop in probability, the more likely we are to reject the new point. Thus, we will tend to stay in (and return large numbers of samples from) high-density regions of [math]\displaystyle{ P(x) }[/math], while only occasionally visiting low-density regions. Intuitively, this is why this algorithm works and returns samples that follow the desired distribution with density [math]\displaystyle{ P(x) }[/math].

Compared with an algorithm like adaptive rejection sampling^{[8]} that directly generates independent samples from a distribution, Metropolis–Hastings and other MCMC algorithms have a number of disadvantages:

- The samples are autocorrelated. Even though over the long term they do correctly follow [math]\displaystyle{ P(x) }[/math], a set of nearby samples will be correlated with each other and not correctly reflect the distribution. This means that effective sample sizes can be significantly lower than the number of samples actually taken, leading to large errors.
- Although the Markov chain eventually converges to the desired distribution, the initial samples may follow a very different distribution, especially if the starting point is in a region of low density. As a result, a
*burn-in*period is typically necessary,^{[9]}where an initial number of samples are thrown away.

On the other hand, most simple rejection sampling methods suffer from the "curse of dimensionality", where the probability of rejection increases exponentially as a function of the number of dimensions. Metropolis–Hastings, along with other MCMC methods, do not have this problem to such a degree, and thus are often the only solutions available when the number of dimensions of the distribution to be sampled is high. As a result, MCMC methods are often the methods of choice for producing samples from hierarchical Bayesian models and other high-dimensional statistical models used nowadays in many disciplines.

In multivariate distributions, the classic Metropolis–Hastings algorithm as described above involves choosing a new multi-dimensional sample point. When the number of dimensions is high, finding the suitable jumping distribution to use can be difficult, as the different individual dimensions behave in very different ways, and the jumping width (see above) must be "just right" for all dimensions at once to avoid excessively slow mixing. An alternative approach that often works better in such situations, known as Gibbs sampling, involves choosing a new sample for each dimension separately from the others, rather than choosing a sample for all dimensions at once. That way, the problem of sampling from potentially high-dimensional space will be reduced to a collection of problems to sample from small dimensionality.^{[10]} This is especially applicable when the multivariate distribution is composed of a set of individual random variables in which each variable is conditioned on only a small number of other variables, as is the case in most typical hierarchical models. The individual variables are then sampled one at a time, with each variable conditioned on the most recent values of all the others. Various algorithms can be used to choose these individual samples, depending on the exact form of the multivariate distribution: some possibilities are the adaptive rejection sampling methods,^{[8]} the adaptive rejection Metropolis sampling algorithm,^{[11]} a simple one-dimensional Metropolis–Hastings step, or slice sampling.

## Formal derivation

The purpose of the Metropolis–Hastings algorithm is to generate a collection of states according to a desired distribution [math]\displaystyle{ P(x) }[/math]. To accomplish this, the algorithm uses a Markov process, which asymptotically reaches a unique stationary distribution [math]\displaystyle{ \pi(x) }[/math] such that [math]\displaystyle{ \pi(x) = P(x) }[/math].^{[12]}

A Markov process is uniquely defined by its transition probabilities [math]\displaystyle{ P(x' \mid x) }[/math], the probability of transitioning from any given state [math]\displaystyle{ x }[/math] to any other given state [math]\displaystyle{ x' }[/math]. It has a unique stationary distribution [math]\displaystyle{ \pi(x) }[/math] when the following two conditions are met:^{[12]}

*Existence of stationary distribution*: there must exist a stationary distribution [math]\displaystyle{ \pi(x) }[/math]. A sufficient but not necessary condition is detailed balance, which requires that each transition [math]\displaystyle{ x \to x' }[/math] is reversible: for every pair of states [math]\displaystyle{ x, x' }[/math], the probability of being in state [math]\displaystyle{ x }[/math] and transitioning to state [math]\displaystyle{ x' }[/math] must be equal to the probability of being in state [math]\displaystyle{ x' }[/math] and transitioning to state [math]\displaystyle{ x }[/math], [math]\displaystyle{ \pi(x) P(x' \mid x) = \pi(x') P(x \mid x') }[/math].*Uniqueness of stationary distribution*: the stationary distribution [math]\displaystyle{ \pi(x) }[/math] must be unique. This is guaranteed by ergodicity of the Markov process, which requires that every state must (1) be aperiodic—the system does not return to the same state at fixed intervals; and (2) be positive recurrent—the expected number of steps for returning to the same state is finite.

The Metropolis–Hastings algorithm involves designing a Markov process (by constructing transition probabilities) that fulfills the two above conditions, such that its stationary distribution [math]\displaystyle{ \pi(x) }[/math] is chosen to be [math]\displaystyle{ P(x) }[/math]. The derivation of the algorithm starts with the condition of detailed balance:

- [math]\displaystyle{ P(x' \mid x) P(x) = P(x \mid x') P(x'), }[/math]

which is re-written as

- [math]\displaystyle{ \frac{P(x' \mid x)}{P(x \mid x')} = \frac{P(x')}{P(x)}. }[/math]

The approach is to separate the transition in two sub-steps; the proposal and the acceptance-rejection. The proposal distribution [math]\displaystyle{ g(x' \mid x) }[/math] is the conditional probability of proposing a state [math]\displaystyle{ x' }[/math] given [math]\displaystyle{ x }[/math], and the acceptance distribution [math]\displaystyle{ A(x', x) }[/math] is the probability to accept the proposed state [math]\displaystyle{ x' }[/math]. The transition probability can be written as the product of them:

- [math]\displaystyle{ P(x'\mid x) = g(x' \mid x) A(x', x). }[/math]

Inserting this relation in the previous equation, we have

- [math]\displaystyle{ \frac{A(x', x)}{A(x, x')} = \frac{P(x')}{P(x)}\frac{g(x \mid x')}{g(x' \mid x)}. }[/math]

The next step in the derivation is to choose an acceptance ratio that fulfills the condition above. One common choice is the Metropolis choice:

- [math]\displaystyle{ A(x', x) = \min\left(1, \frac{P(x')}{P(x)} \frac{g(x \mid x')}{g(x' \mid x)}\right). }[/math]

For this Metropolis acceptance ratio [math]\displaystyle{ A }[/math], either [math]\displaystyle{ A(x', x) = 1 }[/math] or [math]\displaystyle{ A(x, x') = 1 }[/math] and, either way, the condition is satisfied.

The Metropolis–Hastings algorithm can thus be written as follows:

- Initialise
- Pick an initial state [math]\displaystyle{ x_0 }[/math].
- Set [math]\displaystyle{ t = 0 }[/math].

- Iterate
*Generate*a random candidate state [math]\displaystyle{ x' }[/math] according to [math]\displaystyle{ g(x' \mid x_t) }[/math].*Calculate*the acceptance probability [math]\displaystyle{ A(x', x_t) = \min\left(1, \frac{P(x')}{P(x_t)} \frac{g(x_t \mid x')}{g(x' \mid x_t)}\right) }[/math].*Accept or reject*:- generate a uniform random number [math]\displaystyle{ u \in [0, 1] }[/math];
- if [math]\displaystyle{ u \le A(x' , x_t) }[/math], then
*accept*the new state and set [math]\displaystyle{ x_{t+1} = x' }[/math]; - if [math]\displaystyle{ u \gt A(x' , x_t) }[/math], then
*reject*the new state, and copy the old state forward [math]\displaystyle{ x_{t+1} = x_{t} }[/math].

*Increment*: set [math]\displaystyle{ t = t + 1 }[/math].

Provided that specified conditions are met, the empirical distribution of saved states [math]\displaystyle{ x_0, \ldots, x_T }[/math] will approach [math]\displaystyle{ P(x) }[/math]. The number of iterations ([math]\displaystyle{ T }[/math]) required to effectively estimate [math]\displaystyle{ P(x) }[/math] depends on the number of factors, including the relationship between [math]\displaystyle{ P(x) }[/math] and the proposal distribution and the desired accuracy of estimation.^{[13]} For distribution on discrete state spaces, it has to be of the order of the autocorrelation time of the Markov process.^{[14]}

It is important to notice that it is not clear, in a general problem, which distribution [math]\displaystyle{ g(x' \mid x) }[/math] one should use or the number of iterations necessary for proper estimation; both are free parameters of the method, which must be adjusted to the particular problem in hand.

## Use in numerical integration

A common use of Metropolis–Hastings algorithm is to compute an integral. Specifically, consider a space [math]\displaystyle{ \Omega \subset \mathbb{R} }[/math] and a probability distribution [math]\displaystyle{ P(x) }[/math] over [math]\displaystyle{ \Omega }[/math], [math]\displaystyle{ x \in \Omega }[/math]. Metropolis–Hastings can estimate an integral of the form of

- [math]\displaystyle{ P(E) = \int_\Omega A(x) P(x) \,dx, }[/math]

where [math]\displaystyle{ A(x) }[/math] is a (measurable) function of interest.

For example, consider a statistic [math]\displaystyle{ E(x) }[/math] and its probability distribution [math]\displaystyle{ P(E) }[/math], which is a marginal distribution. Suppose that the goal is to estimate [math]\displaystyle{ P(E) }[/math] for [math]\displaystyle{ E }[/math] on the tail of [math]\displaystyle{ P(E) }[/math]. Formally, [math]\displaystyle{ P(E) }[/math] can be written as

- [math]\displaystyle{ P(E) = \int_\Omega P(E\mid x) P(x) \,dx = \int_\Omega \delta\big(E - E(x)\big) P(x) \,dx = E \big(P(E\mid X)\big) }[/math]

and, thus, estimating [math]\displaystyle{ P(E) }[/math] can be accomplished by estimating the expected value of the indicator function [math]\displaystyle{ A_E(x) \equiv \mathbf{1}_E(x) }[/math], which is 1 when [math]\displaystyle{ E(x) \in [E, E + \Delta E] }[/math] and zero otherwise. Because [math]\displaystyle{ E }[/math] is on the tail of [math]\displaystyle{ P(E) }[/math], the probability to draw a state [math]\displaystyle{ x }[/math] with [math]\displaystyle{ E(x) }[/math] on the tail of [math]\displaystyle{ P(E) }[/math] is proportional to [math]\displaystyle{ P(E) }[/math], which is small by definition. The Metropolis–Hastings algorithm can be used here to sample (rare) states more likely and thus increase the number of samples used to estimate [math]\displaystyle{ P(E) }[/math] on the tails. This can be done e.g. by using a sampling distribution [math]\displaystyle{ \pi(x) }[/math] to favor those states (e.g. [math]\displaystyle{ \pi(x) \propto e^{a E} }[/math] with [math]\displaystyle{ a \gt 0 }[/math]).

## Step-by-step instructions

Suppose that the most recent value sampled is [math]\displaystyle{ x_t }[/math]. To follow the Metropolis–Hastings algorithm, we next draw a new proposal state [math]\displaystyle{ x' }[/math] with probability density [math]\displaystyle{ g(x' \mid x_t) }[/math] and calculate a value

- [math]\displaystyle{ a = a_1 a_2, }[/math]

where

- [math]\displaystyle{ a_1 = \frac{P(x')}{P(x_t)} }[/math]

is the probability (e.g., Bayesian posterior) ratio between the proposed sample [math]\displaystyle{ x' }[/math] and the previous sample [math]\displaystyle{ x_t }[/math], and

- [math]\displaystyle{ a_2 = \frac{g(x_t \mid x')}{g(x' \mid x_t)} }[/math]

is the ratio of the proposal density in two directions (from [math]\displaystyle{ x_t }[/math] to [math]\displaystyle{ x' }[/math] and conversely). This is equal to 1 if the proposal density is symmetric. Then the new state [math]\displaystyle{ x_{t+1} }[/math] is chosen according to the following rules.

- If [math]\displaystyle{ a \geq 1{:} }[/math]
- [math]\displaystyle{ x_{t+1} = x', }[/math]

- else:
- [math]\displaystyle{ x_{t+1} = \begin{cases} x' & \text{with probability } a, \\ x_t & \text{with probability } 1-a. \end{cases} }[/math]

The Markov chain is started from an arbitrary initial value [math]\displaystyle{ x_0 }[/math], and the algorithm is run for many iterations until this initial state is "forgotten". These samples, which are discarded, are known as *burn-in*. The remaining set of accepted values of [math]\displaystyle{ x }[/math] represent a sample from the distribution [math]\displaystyle{ P(x) }[/math].

The algorithm works best if the proposal density matches the shape of the target distribution [math]\displaystyle{ P(x) }[/math], from which direct sampling is difficult, that is [math]\displaystyle{ g(x' \mid x_t) \approx P(x') }[/math].
If a Gaussian proposal density [math]\displaystyle{ g }[/math] is used, the variance parameter [math]\displaystyle{ \sigma^2 }[/math] has to be tuned during the burn-in period.
This is usually done by calculating the *acceptance rate*, which is the fraction of proposed samples that is accepted in a window of the last [math]\displaystyle{ N }[/math] samples.
The desired acceptance rate depends on the target distribution, however it has been shown theoretically that the ideal acceptance rate for a one-dimensional Gaussian distribution is about 50%, decreasing to about 23% for an [math]\displaystyle{ N }[/math]-dimensional Gaussian target distribution.^{[15]} These guidelines can work well when sampling from sufficiently regular Bayesian posteriors as they often follow a multivariate normal distribution as can be established using the Bernstein–von Mises theorem.^{[16]}

If [math]\displaystyle{ \sigma^2 }[/math] is too small, the chain will *mix slowly* (i.e., the acceptance rate will be high, but successive samples will move around the space slowly, and the chain will converge only slowly to [math]\displaystyle{ P(x) }[/math]). On the other hand,
if [math]\displaystyle{ \sigma^2 }[/math] is too large, the acceptance rate will be very low because the proposals are likely to land in regions of much lower probability density, so [math]\displaystyle{ a_1 }[/math] will be very small, and again the chain will converge very slowly. One typically tunes the proposal distribution so that the algorithms accepts on the order of 30% of all samples – in line with the theoretical estimates mentioned in the previous paragraph.

## Bayesian Inference

MCMC can be used to draw samples from the posterior distribution of a statistical model. The acceptance probability is given by: [math]\displaystyle{ P_{acc}(\theta_i \to \theta^*)=\min\left(1, \frac{\mathcal{L}(y|\theta^*)P(\theta^*)}{\mathcal{L}(y|\theta_i)P(\theta_i)}\frac{Q(\theta_i|\theta^*)}{Q(\theta^*|\theta_i)}\right), }[/math] where [math]\displaystyle{ \mathcal{L} }[/math] is the likelihood, [math]\displaystyle{ P(\theta) }[/math] the prior probability density and [math]\displaystyle{ Q }[/math] the (conditional) proposal probability.

## See also

- Detailed balance
- Genetic algorithms
- Gibbs sampling
- Hamiltonian Monte Carlo
- Mean-field particle methods
- Metropolis-adjusted Langevin algorithm
- Metropolis light transport
- Multiple-try Metropolis
- Parallel tempering
- Preconditioned Crank–Nicolson algorithm
- Sequential Monte Carlo
- Simulated annealing

## References

- ↑ Kalos, Malvin H.; Whitlock, Paula A. (1986).
*Monte Carlo Methods Volume I: Basics*. New York: Wiley. pp. 78-88. - ↑ Tierney, Luke (1994). "Markov chains for exploring posterior distributions".
*The Annals of Statistics***22**(4): 1701-1762. https://projecteuclid.org/journals/annals-of-statistics/volume-22/issue-4/Markov-Chains-for-Exploring-Posterior-Distributions/10.1214/aos/1176325750.full. - ↑ Hastings, W.K. (1970). "Monte Carlo Sampling Methods Using Markov Chains and Their Applications".
*Biometrika***57**(1): 97–109. doi:10.1093/biomet/57.1.97. Bibcode: 1970Bimka..57...97H. - ↑ M.N. Rosenbluth (2003). "Genesis of the Monte Carlo Algorithm for Statistical Mechanics".
*AIP Conference Proceedings***690**: 22–30. doi:10.1063/1.1632112. Bibcode: 2003AIPC..690...22R. - ↑ J.E. Gubernatis (2005). "Marshall Rosenbluth and the Metropolis Algorithm".
*Physics of Plasmas***12**(5): 057303. doi:10.1063/1.1887186. Bibcode: 2005PhPl...12e7303G. https://zenodo.org/record/1231899. - ↑ Teller, Edward.
*Memoirs: A Twentieth-Century Journey in Science and Politics*. Perseus Publishing, 2001, p. 328 - ↑ Rosenbluth, Marshall. "Oral History Transcript". American Institute of Physics
- ↑
^{8.0}^{8.1}Gilks, W. R.; Wild, P. (1992-01-01). "Adaptive Rejection Sampling for Gibbs Sampling".*Journal of the Royal Statistical Society. Series C (Applied Statistics)***41**(2): 337–348. doi:10.2307/2347565. - ↑
*Bayesian data analysis*. Gelman, Andrew (2nd ed.). Boca Raton, Fla.: Chapman & Hall / CRC. 2004. ISBN 978-1584883883. OCLC 51991499. - ↑ Lee, Se Yoon (2021). "Gibbs sampler and coordinate ascent variational inference: A set-theoretical review".
*Communications in Statistics - Theory and Methods***51**(6): 1549–1568. doi:10.1080/03610926.2021.1921214. - ↑ Gilks, W. R.; Best, N. G.; Tan, K. K. C. (1995-01-01). "Adaptive Rejection Metropolis Sampling within Gibbs Sampling".
*Journal of the Royal Statistical Society. Series C (Applied Statistics)***44**(4): 455–472. doi:10.2307/2986138. - ↑
^{12.0}^{12.1}Robert, Christian; Casella, George (2004).*Monte Carlo Statistical Methods*. Springer. ISBN 978-0387212395. https://archive.org/details/springer_10.1007-978-1-4757-4145-2. - ↑ Raftery, Adrian E., and Steven Lewis. "How Many Iterations in the Gibbs Sampler?"
*In Bayesian Statistics 4*. 1992. - ↑ Newman, M. E. J.; Barkema, G. T. (1999).
*Monte Carlo Methods in Statistical Physics*. USA: Oxford University Press. ISBN 978-0198517979. - ↑ Roberts, G.O.; Gelman, A.; Gilks, W.R. (1997). "Weak convergence and optimal scaling of random walk Metropolis algorithms".
*Ann. Appl. Probab.***7**(1): 110–120. doi:10.1214/aoap/1034625254. http://www.stat.columbia.edu/~gelman/research/published/theory7.ps. - ↑ Schmon, Sebastian M.; Gagnon, Philippe (2022-04-15). "Optimal scaling of random walk Metropolis algorithms using Bayesian large-sample asymptotics" (in en).
*Statistics and Computing***32**(2): 28. doi:10.1007/s11222-022-10080-8. ISSN 0960-3174. PMID 35310543.

## Notes

- ↑ In the original paper by Metropolis et al. (1953), [math]\displaystyle{ f }[/math] was taken to be the Boltzmann distribution as the specific application considered was Monte Carlo integration of equations of state in physical chemistry; the extension by Hastings generalized to an arbitrary distribution [math]\displaystyle{ f }[/math].
- ↑ In the original paper by Metropolis et al. (1953), [math]\displaystyle{ g(x\mid y) }[/math] was suggested to be a random translation with uniform density over some prescribed range.
- ↑ In the original paper by Metropolis et al. (1953), [math]\displaystyle{ f }[/math] was actually the Boltzmann distribution, as it was applied to physical systems in the context of statistical mechanics (e.g., a maximal-entropy distribution of microstates for a given temperature at thermal equilibrium). Consequently, the acceptance ratio was itself an exponential of the difference in the parameters of the numerator and denominator of this ratio.

## Further reading

- Bernd A. Berg.
*Markov Chain Monte Carlo Simulations and Their Statistical Analysis*. Singapore, World Scientific, 2004. - Siddhartha Chib and Edward Greenberg: "Understanding the Metropolis–Hastings Algorithm".
*American Statistician*, 49(4), 327–335, 1995 - David D. L. Minh and Do Le Minh. "Understanding the Hastings Algorithm." Communications in Statistics - Simulation and Computation, 44:2 332-349, 2015
- Bolstad, William M. (2010)
*Understanding Computational Bayesian Statistics*,*John Wiley & Sons*ISBN:0-470-04609-0

Original source: https://en.wikipedia.org/wiki/Metropolis–Hastings algorithm.
Read more |