Create Your Own Metropolis-Hastings Markov Chain Monte Carlo Algorithm for Bayesian Inference (With Python)
Published in
6 min readMay 15, 2023
In today’s recreational coding exercise, we learn how to fit model parameters to data (with error bars) and obtain the most likely distribution of modeling parameters that best explain the data, called the posterior distribution. We will do so in a Bayesian framework, which is a very powerful approach because it allows us to incorporate prior knowledge and uncertainties, and to update our beliefs about the model parameters as we observe more data. We will sample the posterior…