Skip to contentScholarGate
LibraryBookshelfDeskReview StudioAssistant
Sign in
On this page
IntuitionHow it worksWhen to use itStrengths & limitationsCommon pitfallsApplicationsFrequently asked🔒 Read the full methodSourcesRelated methods
Cite this pageSpotted an issue on this page? Report or suggest a fix →
Home›Bayesian›Metropolis-Hastings Algorithm
Bayesian methods

Metropolis-Hastings Algorithm

Metropolis-Hastings Markov Chain Monte Carlo Algorithm · Also known as: MH algorithm, M-H algorithm, Metropolis algorithm, Metropolis-Hastings sampler, acceptance-rejection MCMC, general-purpose MCMC sampler

The Metropolis-Hastings (MH) algorithm is a general-purpose Markov chain Monte Carlo (MCMC) method for drawing samples from any probability distribution whose density can be evaluated up to a normalising constant. Introduced by Metropolis, Rosenbluth, Rosenbluth, Teller, and Teller (1953) in computational physics and generalised by Hastings (1970) to asymmetric proposal distributions, it is the foundational algorithm from which nearly all subsequent MCMC samplers — Gibbs sampling, Hamiltonian Monte Carlo, slice sampling — are derived or can be viewed as special cases.

ScholarGate
  1. Bayesian methods
  2. v1
  3. 4 Sources
  4. PUBLISHED
Cite this page →
Tools & resources
Download slides
Learn & explore

Read the full method

Members only

Sign in with a free account to read this section.

Sign in

Method map

The neighbourhood of related methods — select a node to explore.

Metropolis-Hastings Algorithm
Bayesian RegressionGibbs SamplingHamiltonian Monte CarloSequential Monte CarloSlice SamplingDynamic Metropolis-Hasti…Hierarchical Markov Chai…MCMC with missing dataMetropolis-Hastings with…Multilevel Gibbs Sampling

+2 more

When to use it

Use the Metropolis-Hastings algorithm whenever the target posterior distribution cannot be sampled from directly and no conjugate or closed-form solution is available. It is applicable to virtually any Bayesian model — regression, hierarchical models, latent variable models, mixture models — as long as the unnormalised posterior density can be evaluated pointwise. Key assumptions are that the target distribution has the same support as the proposal (irreducibility), that the chain is aperiodic, and that sufficient iterations are run for convergence. It becomes inefficient in very high-dimensional parameter spaces, where Hamiltonian Monte Carlo is typically preferred.

Strengths & limitations

Strengths
  • Completely general: applies to any target distribution evaluable up to a constant, with no conjugacy or closed-form requirements.
  • The normalising constant of the posterior (the marginal likelihood) is never required — it cancels in the acceptance ratio.
  • Asymptotically correct: the stationary distribution of the chain is exactly the target, guaranteed by detailed balance.
  • Conceptually transparent and straightforward to implement for low- to moderate-dimensional problems.
  • Serves as the backbone for more advanced samplers (Gibbs, HMC, NUTS, reversible-jump MCMC) which are all special or extended cases.
Limitations
  • Efficiency degrades sharply with dimension: tuning the proposal scale to achieve the optimal acceptance rate (around 23% for a random-walk Gaussian proposal in high dimensions) becomes progressively harder.
  • Correlated samples — inherent to any Markov chain — inflate Monte Carlo standard errors relative to independent samples; effective sample size is always less than the raw chain length.
  • Convergence is asymptotic and must be diagnosed empirically (R-hat, effective sample size, trace plots); there is no finite-time guarantee of proximity to the target.
  • Mixing can be extremely slow when the posterior is multimodal, banana-shaped, or has strong parameter correlations.

Frequently asked

How do I choose the proposal distribution?

For a random-walk proposal, the standard recommendation is to tune the proposal standard deviation so that the acceptance rate falls between roughly 20% and 50%; for a d-dimensional Gaussian target the theoretically optimal rate is about 23.4%. In practice, run short pilot chains, adjust the scale, and verify that trace plots show healthy mixing. Adaptive MH methods automate this tuning by updating the proposal covariance online during burn-in.

What is the difference between the Metropolis and the Metropolis-Hastings algorithm?

The original 1953 Metropolis algorithm requires a symmetric proposal distribution, so the proposal ratio q(θ^(t)|θ*)/q(θ*|θ^(t)) equals 1 and drops from the acceptance ratio. Hastings' 1970 generalisation retains this correction factor, enabling any proposal distribution — including directed, independent, or data-driven proposals — while preserving the correct stationary distribution.

How do I know when the chain has converged?

Run at least four chains from overdispersed starting points. Compute the Gelman-Rubin potential scale reduction factor R-hat for each parameter; values below 1.01 indicate acceptable convergence. Also inspect trace plots for stationarity and compute the effective sample size (ESS); a minimum ESS of around 400 per parameter is a common practical threshold. A bulk ESS and tail ESS are reported by modern software such as ArviZ and Stan.

When should I prefer Hamiltonian Monte Carlo over Metropolis-Hastings?

Hamiltonian Monte Carlo (HMC) exploits gradient information about the posterior to make large, informed moves with high acceptance rates. For smooth, continuous posteriors in moderate to high dimensions (roughly 10 or more parameters), HMC and its adaptive variant NUTS substantially outperform a random-walk MH sampler in effective samples per second. Plain MH remains useful for low-dimensional problems, discrete parameter spaces (where gradients are unavailable), and as a pedagogical and theoretical reference point.

Sources

  1. Metropolis, N., Rosenbluth, A. W., Rosenbluth, M. N., Teller, A. H., & Teller, E. (1953). Equation of state calculations by fast computing machines. The Journal of Chemical Physics, 21(6), 1087–1092. DOI: 10.1063/1.1699114 ↗
  2. 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 ↗
  3. Robert, C. P., & Casella, G. (2004). Monte Carlo Statistical Methods (2nd ed.). Springer. ISBN: 978-0-387-21239-5
  4. Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A., & Rubin, D. B. (2013). Bayesian Data Analysis (3rd ed.). CRC Press. ISBN: 978-1-439-84095-5

How to cite this page

ScholarGate. (2026, June 3). Metropolis-Hastings Markov Chain Monte Carlo Algorithm. ScholarGate. https://scholargate.app/en/bayesian/metropolis-hastings-algorithm

Related methods

Bayesian RegressionGibbs SamplingHamiltonian Monte CarloSequential Monte CarloSlice Sampling

Which method?

Set this method beside its closest kin and read them side by side — the library lays the books on the table; the choice is yours.

  • Bayesian RegressionBayesian↔ compare
  • Gibbs SamplingBayesian↔ compare
  • Hamiltonian Monte CarloBayesian↔ compare
  • Sequential Monte CarloBayesian↔ compare
  • Slice SamplingBayesian↔ compare
Compare side by side →

Referenced by

Dynamic Metropolis-Hastings AlgorithmHierarchical Markov Chain Monte CarloMCMC with missing dataMetropolis-Hastings with Missing DataMultilevel Gibbs SamplingMultilevel MCMCMultilevel Metropolis-Hastings

Similar methods

Markov Chain Monte CarloMCMCMultilevel Metropolis-HastingsGibbs SamplingDynamic Metropolis-Hastings AlgorithmMetropolis-Hastings with Missing DataMetropolis-Hastings for model comparisonSlice Sampling

Related reference concepts

Metropolis-Hastings AlgorithmMarkov Chain Monte CarloMarkov Chain Monte CarloBayesian Computation and MCMCMetropolis Monte Carlo in PhysicsHamiltonian Monte Carlo

Spotted an issue on this page? Report or suggest a fix →

ScholarGate — Metropolis-Hastings Algorithm (Metropolis-Hastings Markov Chain Monte Carlo Algorithm). Retrieved 2026-07-21 from https://scholargate.app/en/bayesian/metropolis-hastings-algorithm · Dataset: https://doi.org/10.5281/zenodo.20539026
Quick facts
Family
Bayesian / MCMC
Type
Markov chain Monte Carlo sampler
Purpose
posterior sampling / numerical integration
Originator
Metropolis et al. (1953); generalised by Hastings (1970)
Year
1953
Acceptance Rule
Metropolis-Hastings ratio
Stationarity
detailed balance / reversibility
Outputs
correlated samples from the target posterior distribution
Related methods
Bayesian RegressionGibbs SamplingHamiltonian Monte CarloSequential Monte CarloSlice Sampling
ScholarGate

A content-first reference library for research methods — what each one is, how it works, and where it comes from.

Open data (CC-BY)

Explore

  • Library
  • Search the library…
  • Browse by field
  • Fields
  • Journey
  • Compare
  • Which method?

Reference

  • Subjects
  • Atlas
  • Glossary
  • Methodology
  • Philosophy

Your tools

  • Bookshelf
  • Desk
  • Chat

Company

  • About
  • Pricing
  • Contact
  • Suggest a method

Entries are compiled from published sources for reference. Verifying the accuracy and suitability of any information for your own use remains your responsibility.

© 2026 ScholarGate · A research-method reference library
  • Privacy
  • Cookies
  • Terms
  • Delete account