# Markov Chain Monte Carlo
> [!quote] Markov chain Monte Carlo (MCMC) is a technique for estimating by simulation the expectation of a statistic in a complex model. Successive random selections form a Markov chain, the stationary distribution of which is the target distribution. It is particularly useful for the evaluation of posterior distributions in complex Bayesian models. In the Metropolis–Hastings algorithm, items are selected from an arbitrary “proposal” distribution and are retained or not according to an acceptance rule. The Gibbs sampler is a special case in which the proposal distributions are conditional distributions of single components of a vector parameter. Various special cases and applications are considered.
> [Markov Chain Monte Carlo - Gilks - 2005 - Major Reference Works - Wiley Online Library](https://onlinelibrary.wiley.com/doi/abs/10.1002/0470011815.b2a14021?deniedAccessCustomisedMessage=&userIsAuthenticated=false)
This definition is kind of comprehensible to me, but there is more real-world takes in for example: [Markov Chain Monte Carlo Without all the Bullshit – Math ∩ Programming](https://jeremykun.com/2015/04/06/markov-chain-monte-carlo-without-all-the-bullshit/).
MCMC is used to [[Sampling (Statistics)|sample]] from a complicated [[Probability Distribution]], and is a core technique of [[Probabilistic Programming]] and [[Bayesian Statistics]].
The main algorithms used are:
- [[Metropolis-Hastings Algorithm]]
- [[Gibbs Sampling]]
## See Also
This book has a full chapter dedicated to [[Random Walks]] and [[Markov Chains]].
- [[BOOK - Foundations of Data Science - Avrim Blum John Hopcroft Ravi Kannan]]
[[Luke Gorrie]] posts a lot about sampling lately:
- [https://twitter.com/lukego](https://twitter.com/lukego)
- [[Bayesian Statistics]]
## Links
Lecture 13 and 14 of [[COURSE - Stanford - The Modern Algorithmic Toolbox]] are about sampling, estimation and MCMC techniques:
- [PDF - Modern Algorithmic Toolbox Lecture #13 - Sampling and Estimation](https://www.evernote.com/shard/s6/u/0/sh/f6492cca-8077-4a2a-868e-97c8c30302f8/53d53c83472b4256ec029c19e367240f)
- Lecture 14 is explicitly about MCMC: [PDF - The Modern Algorithmic Toolbox Lecture #14: Markov Chain Monte Carlo](https://www.evernote.com/shard/s6/u/0/sh/b33574a6-ec8b-4dd6-b782-2afeb71b047a/773086f1e992e9bf92c0a79e578f7f91)
That lectures links to:
> [!quote] here’s my own explanation of Markov Chain Monte Carlo, inspired by the treatment of [John Hopcroft and Ravi Kannan](http://research.microsoft.com/en-US/people/kannan/book-no-solutions-aug-21-2014.pdf).
- [Markov Chain Monte Carlo Without all the Bullshit – Math ∩ Programming](https://jeremykun.com/2015/04/06/markov-chain-monte-carlo-without-all-the-bullshit/)
> [!quote] The use of simulation for high dimensional intractable computations has revolutionized applied mathematics. Designing, improving and understanding the new tools leads to (and leans on) fascinating mathematics, from representation theory through micro-local analysis.
- [TheMarkov Chain Monte Carlo Revolution - Diaconis](https://www.evernote.com/shard/s6/u/0/sh/2aad548c-1a69-4aca-9d46-be78e2a399ba/8a2008e448aa4b87374dd5c53e7b7fa2)