Concept Architecture
Concept
Theoretically, Metropolis-Hastings is a Markov Chain Monte Carlo (MCMC) algorithm for generating random samples from a target probability distribution when direct sampling is impractical or impossible. It extends the original Metropolis algorithm by allowing candidate values to be proposed from an arbitrary proposal distribution, with acceptance determined by an acceptance probability that ensures convergence to the target distribution. In health economics, the algorithm is widely used for Bayesian parameter estimation, evidence synthesis, and probabilistic modelling where posterior distributions have no closed-form solution.
Mathematically, the algorithm constructs a Markov chain whose stationary distribution is the target posterior distribution. At each iteration, a candidate parameter value is generated from a proposal distribution and accepted with a probability derived from the ratio of the target density and the proposal density. Repeated iterations produce samples that converge asymptotically to the target distribution, allowing posterior expectations and uncertainty measures to be estimated through Monte Carlo integration.
In practice, Metropolis-Hastings is implemented within Bayesian software such as JAGS, WinBUGS, OpenBUGS and custom statistical programs. The algorithm is applied to estimate posterior distributions of clinical, epidemiological and economic model parameters, particularly where Gibbs sampling cannot be applied directly. Posterior samples are subsequently used in probabilistic sensitivity analysis, Bayesian network meta-analysis and decision-analytic modelling.
Purpose
Used to generate samples from complex posterior probability distributions for Bayesian estimation, uncertainty quantification, probabilistic sensitivity analysis, and evidence synthesis in health economic evaluation.
Mathematical Formulae
Primary Formula
For a current state ? and proposed state ?*, the acceptance probability is
�(?, ?) = min(1, (�(?) q(? | ?)) / (�(?) q(? | ?)))
where:
- �(?) = target probability density
- q(? | ?)* = proposal distribution
- � = probability of accepting the proposed state
Supporting Formulae
Candidate generation:
? ~ q(? | ?)**
Monte Carlo estimate:
E[f(?)] � (1/N) �???? f(??)
Special case for symmetric proposal distributions:
� = min(1, �(?*) / �(?))
Related Mathematical Methods
- Markov Chain Monte Carlo
- Bayesian inference
- Gibbs sampling
- Hamiltonian Monte Carlo
- Monte Carlo integration
- Bayesian network meta-analysis
- Probabilistic sensitivity analysis
Example
A Bayesian network meta-analysis estimates the relative treatment effect of a new oncology intervention.
The current parameter estimate is
? = 0.42
A candidate value
? = 0.48*
is proposed from a normal proposal distribution.
The posterior density ratio and proposal ratio produce
� = 0.81
A uniform random number of 0.37 is generated.
Since
0.37 < 0.81
the proposed value is accepted and becomes the next state of the Markov chain. Repeating this process for many iterations produces posterior samples used to estimate treatment effects, costs and QALYs.
Excel Implementation
| Function | Example Formula | Health Economics Application |
|---|---|---|
| RAND | =RAND() | Generate uniform random numbers for acceptance decisions |
| NORM.INV | =NORM.INV(RAND(),CurrentValue,ProposalSD) | Generate candidate parameter values |
| MIN | =MIN(1,AcceptanceRatio) | Calculate acceptance probability |
| IF | =IF(RAND()<AcceptanceProbability,Proposal,CurrentValue) | Accept or reject candidate value |
| AVERAGE | =AVERAGE(B2:B50001) | Estimate posterior mean after convergence |
VBA (Optional)
Automate Metropolis-Hastings iterations, convergence diagnostics and storage of posterior samples for subsequent probabilistic sensitivity analysis.
Sources
- Metropolis N, Rosenbluth AW, Rosenbluth MN, Teller AH, Teller E. Equation of State Calculations by Fast Computing Machines. Journal of Chemical Physics. 1953;21:1087-1092.
- Hastings WK. Monte Carlo Sampling Methods Using Markov Chains and Their Applications. Biometrika. 1970;57(1):97-109.
- Gelman A, Carlin JB, Stern HS, Dunson DB, Vehtari A, Rubin DB. Bayesian Data Analysis. 3rd ed. CRC Press; 2013.
- Brooks S, Gelman A, Jones GL, Meng XL, eds. Handbook of Markov Chain Monte Carlo. CRC Press; 2011.
- Briggs AH, Claxton K, Sculpher MJ. Decision Modelling for Health Economic Evaluation. Oxford University Press; 2006.
Related Concepts (2)
Library
Publications
1
Decision Modelling for Health Economic Evaluation — Briggs, Claxton & Sculpher, 1st Edition ed., 2006 (Oxford University Press)
Foundational textbook on decision-analytic modelling for economic evaluation, covering decision trees, Markov models, handling parameter and structural uncertainty, probabilistic sensitivity analysis, and value of information. Volume 1 in the Handbooks in Health Economic Evaluation series.
BookView source →
Frequently Asked Questions (6)
What is the Metropolis-Hastings algorithm?
A Markov chain Monte Carlo algorithm generating samples by proposing candidate values and accepting or rejecting them by a rule ensuring convergence.
Source: Hastings 1970
What are the two steps of the Metropolis-Hastings algorithm?
The algorithm proceeds in two steps at each iteration. First it proposes a candidate next value, drawn from a proposal distribution centred on the current one. Then it applies an acceptance rule that compares how probable the candidate is against the current value under the target distribution, accepting the move with a calculated chance and otherwise staying put. Repeating these propose-and-test steps generates a chain whose values follow the target. Chib and Greenberg (1995) explain the method.
Source: Chib & Greenberg 1995
How does the Metropolis-Hastings algorithm work?
The Metropolis-Hastings algorithm works by, at each step, proposing a candidate new state from a proposal distribution, then computing an acceptance probability from the ratio of the target density at the candidate and current states, adjusted for the proposal. The candidate is accepted with this probability, becoming the new state, or rejected, leaving the chain at the current state. Repeating this generates a Markov chain that converges to the target distribution, so its samples, after burn-in, represent draws from it.
Source: Hastings 1970
What is the role of the acceptance rule in the Metropolis-Hastings algorithm?
The acceptance rule in Metropolis-Hastings ensures that the Markov chain has the target distribution as its stationary distribution, by accepting moves in a way that makes the chain spend time in each region in proportion to its probability. Moves to more probable states are always accepted, and moves to less probable ones are accepted with a probability that maintains the correct balance. This rule is what guarantees convergence to the target, allowing the algorithm to sample correctly even without direct knowledge of the distribution's normalising constant.
Source: Hastings 1970
How does the proposal distribution affect Metropolis-Hastings?
The proposal distribution affects the efficiency of Metropolis-Hastings by determining how candidate moves are generated. If proposals are too small, the chain moves slowly and explores the distribution inefficiently; if too large, many proposals are rejected, also slowing progress. A well-tuned proposal balances acceptance and movement, allowing the chain to mix well. Because the proposal influences convergence and mixing, it is chosen or tuned carefully, which is a practical consideration distinguishing Metropolis-Hastings from Gibbs sampling, which needs no proposal.
Source: Hastings 1970
How does Metropolis-Hastings relate to Gibbs sampling?
Metropolis-Hastings and Gibbs sampling are both Markov chain Monte Carlo methods, and Gibbs sampling can be seen as a special case of Metropolis-Hastings in which proposals are drawn from the full conditional distributions and always accepted. Metropolis-Hastings is more general, requiring only that the target density can be evaluated up to a constant and using a proposal with an acceptance rule, so it applies when the conditionals needed for Gibbs are unavailable. The two are related tools within the Markov chain Monte Carlo family.
Source: Gelfand & Smith 1990
Trust Record
Verified by Dr Darrin Baines
British health economist
Professional identity: darrinbaines.org
Verification date: 9 Oct 2025
Content version: 1.0.0
Canonical Identity
- Persistent URI
- https://healtheconomics.wiki/concept/metropolis-hastings
- Term code
- HE-EM-MP-025
Stable URI · Machine-readable · Resolvable · CC BY 4.0