# Fitting Models to Data

## The Bayesian Approach

Bayes' Theorem

Bayes' theorem states that the posterior is equal to the product of the likelihood and prior, normalised by the evidence: $P(A|B) = \frac{P(B | A)\, P(A)}{P(B)}.$ For example, given an exponential distribution, the posterior is: $P(\lambda|x) = \frac{P(x|\lambda)\, P(\lambda)}{P(x)}.$ The amount of data we obtain is crucial in determining the amount of error associated with deriving the posterior. As the size of the data set increases, the standard deviation of the posterior decreases and its maximum increases. The figure on the right shows the posterior of an exponential distribution plotted against its parameter λ for various sizes of data sets.