Metropolis–Hastings algorithm: Difference between revisions

Content deleted Content added
m changed name of article (within article); link to Gibbs sampling
introductory paragraph & two refs
Line 1:
In [[mathematics]] and [[physics]],
The '''Metropolis-Hastings [[algorithm]]''' can draw samples from any [[probability distribution]]
the '''Metropolis-Hastings algorithm''' is an [[algorithm]] to generate a sequence of samples from the [[joint distribution]] of two or more variables.
This algorithm is an example of a [[Markov chain Monte Carlo]] algorithm.
It is a generalization of the [[Metropolis algorithm]] suggested by Hastings (citation below).
The [[Gibbs sampling]] algorithm is a special case of the Metropolis-Hastings algorithm.
 
The '''Metropolis-Hastings [[algorithm]]''' can draw samples from any [[probability distribution]]
''P(x)'', requiring only that the density can be calculated at ''x''. The algorithm generates a set of states x<sup>t</sup> which is a [[Markov chain]] because each state x<sup>t</sup> depends only on the previous state x<sup>t-1</sup>. The algorithm depends on the creation of a ''proposal density'' Q(x<sup>t</sup>;x') which depends on the current state x<sup>t</sup> and which can generate a new proposed sample x'. For example, the proposal density could be a [[Gaussian function]] centred on the current state x<sup>t</sup>
 
Line 32 ⟶ 38:
The Markov chain is started from a random initial value x<sup>0</sup> and the algorithm is run for a few thousand iterations so that this initial state is "forgotten". These samples, which are discarded, are known as <em>burn-in</em>. The algorithm works best if the proposal density matches the shape of the target distribution P(x), but in most cases this is unknown. If a Gaussian proposal is used the variance parameter &sigma;<sup>2</sup> 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 N samples. This is usually set to be around 60%. If the proposal steps are too small the chain will ''mix slowly'' i.e. it will move around the space slowly and converge slowly to P(x). If the proposal steps are too large the acceptance rate will be very low because the proposals are likely to land in regions of much lower probability density so a<sub>1</sub> will be very small.
 
== References ==
The [[Gibbs sampling]] algorithm is a special case of the Metropolis-Hastings algorithm.
 
* W.K. Hastings. "Monte Carlo Sampling Methods Using Markov Chains and Their Applications", ''Biometrika'', 57:97-109, 1970.
 
* N. Metropolis, A.W. Rosenbluth, M.N. Rosenbluth, A.H. Teller, and E. Teller. "Equations of State Calculations by Fast Computing Machines". ''Journal of Chemical Physics'', 21:1087-1091, 1953.