Markov Chain Monte Carlo (MCMC)
Markov Chain Monte Carlo · Also known as: markov chain monte carlo, MCMC sampling, MCMC (Markov Zinciri Monte Carlo)
Markov Chain Monte Carlo (MCMC) is a family of computational algorithms for sampling from complex probability distributions, most commonly the posterior distributions that arise in Bayesian inference. Rather than computing posteriors analytically — which is rarely possible for realistic models — MCMC constructs a Markov chain whose stationary distribution is the target posterior and draws dependent samples from it, enabling full probabilistic inference for virtually any model.
Read the full method
Sign in with a free account to read this section.
Method map
The neighbourhood of related methods — select a node to explore.
+25 more
When to use it
MCMC is the standard tool for Bayesian inference whenever the posterior has no closed form — that is, whenever the model is not conjugate or is genuinely complex (hierarchical structure, non-linear relationships, heavy-tailed distributions). A minimum sample of about 20 observations is needed for the chains to have a signal to converge on; below that, the posterior is dominated by the prior and the samples carry no information about the data. It applies to continuous, binary, and categorical outcomes across cross-sectional and longitudinal designs.
Strengths & limitations
- Samples from virtually any posterior regardless of the model's complexity or dimensionality.
- Provides the full posterior distribution, not just a point estimate, so uncertainty is explicitly quantified.
- Does not require normality of the data or the outcome — applicable to hierarchical, non-linear, and non-standard models.
- Posterior samples can be used directly for any derived quantity (differences, ratios, predictions) without additional approximation.
- Requires specifying a model and priors; misspecified priors can dominate the posterior, especially when the sample is small.
- Convergence is not guaranteed and must be diagnosed explicitly through R-hat, ESS, and trace-plot inspection.
- Computationally intensive for large datasets or high-dimensional parameter spaces compared to frequentist alternatives.
- With fewer than 20 observations, chains may fail to converge and the posterior simply reflects the prior rather than the data.
Frequently asked
How do I know when the MCMC chains have converged?
The primary diagnostic is R-hat (potential scale reduction factor): values below about 1.1 — and ideally below 1.01 — indicate that multiple chains have mixed and are sampling from the same distribution. You should also check the effective sample size (ESS), which should be large enough (typically at least a few hundred per parameter) to give stable estimates, and visually inspect trace plots to confirm that chains are mixing freely without trends or sticking.
What is the difference between Metropolis-Hastings and Hamiltonian Monte Carlo (HMC/NUTS)?
Metropolis-Hastings proposes new parameter values from a simple proposal distribution and accepts or rejects them based on the likelihood-prior ratio; it is general but can be slow to explore high-dimensional posteriors. HMC uses gradient information from the log-posterior to simulate physical dynamics that guide proposals toward high-probability regions, making large, distant steps that are still accepted at high rates. NUTS is a self-tuning version of HMC that removes the need to set the number of leapfrog steps manually.
How many iterations do I need?
There is no universal answer, but a common starting point is a warm-up (tuning) phase of 1,000 iterations followed by 2,000 or more sampling iterations per chain, run across at least four chains. What matters is not the raw count but whether the ESS is adequate and R-hat is below 1.1. Complex or high-dimensional models typically need more iterations.
Can MCMC be used when my data are not normally distributed?
Yes — one of MCMC's principal advantages is that it does not require the data or the outcome to be normally distributed. You specify the likelihood that matches your data type (Poisson for counts, Bernoulli for binary outcomes, Student-t for heavy tails, etc.) and MCMC samples from the resulting posterior regardless of its shape.
Sources
- 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-1439840955
- Brooks, S., Gelman, A., Jones, G. & Meng, X.-L. (Eds.). (2011). Handbook of Markov Chain Monte Carlo. CRC Press. ISBN: 978-1420079418
How to cite this page
ScholarGate. (2026, June 1). Markov Chain Monte Carlo. ScholarGate. https://scholargate.app/en/bayesian/mcmc
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 Model AveragingBayesian↔ compare
- Bayesian RegressionBayesian↔ compare
- Variational InferenceBayesian↔ compare