Markov Chain Monte Carlo (MCMC) is a powerful computational technique used in Bayesian statistics to draw samples from a posterior distribution when direct sampling is difficult. It is particularly useful when the posterior distribution is complex and does not have a closed-form solution.

Key Concepts of MCMC

  1. Bayesian Inference \& Posterior Distribution

    where:

  2. Markov Chains

  3. Monte Carlo Sampling

Popular MCMC Algorithms

  1. Metropolis-Hastings Algorithm
  2. Gibbs Sampling
  3. Hamiltonian Monte Carlo (HMC)

🧠Python Example: MCMC with Metropolis-Hastings

Here's an implementation to estimate the mean of a normal distribution using MCMC:

https://gist.github.com/viadean/8b70b20cd524951303047564eec8ba5e

Why Use MCMC?