## Bayesian inference

Bayesian inference is a way of drawing statistical inferences from data. You make a model with parameters θ. You then use Bayes rule to get the probability distribution for those parameters after we observe data.

Bayes rule gives you a way to get from p(data | θ) to p(θ | data), flipping round the equation to give you the posterior. An alternative way of thinking about it is that it gives you a way to update your beliefs after you observe new data.

We go to a lot of hard work to calculate the posterior distribution, which is what the data tells you about the parameters of your model. From the posterior you can make summaries of your analysis to state the likely values of the parameters of the model, and you can also make predictions from the posterior.

### Sampling to get the posterior

The posterior is really hard to calculate exactly, because the evidence term is usually a horrible integral. We take advantage of something we found in the section about evidence to rewrite Bayes rule as a similarity relation.

This trick lets us use a family of techniques called Markov Chain Monte Carlo sampling. These techniques let us get a very good approximation of the posterior distribution, and allows us to solve real world problems.