# Understanding posterior probability (Bayesian inference)

I'm reading this online book and there is something unclear to me in this table where the posterior probability of each model computed as:

$$\ P(model \ | \ data) = \frac{P(data \ | \ model) \times P(model)}{P(data) }$$

I understand $$\ P(model)$$ is a prior, and $$\ P(data \ | model )$$ is just a binomial (probability of observing such data given the prior) distribution but what exactly is $$\ P(data)$$ ?

It's just a normalizing constant which makes the posterior a valid density. In practice, we don't care so much about it. It should be noted that

$$p(x) = \int p(x\vert \theta) p(\theta) \, d\theta$$

So it is as if you are averaging the likelihood over the prior.

• Ok so is it as if I would say that $\ P(model | data)$ proportional to $\ P(data | model) \times P(model)$ ? If i understand correctly then I just take the $\ P(data \ | \ model) \times \ P(model)$ and divide it by the sum of all $\ P(data | model)P(model($ to get the posterior probability of each? Commented Jan 16, 2020 at 16:56
• That's right. Often times, we just write bayes rule as a proportionality rather than an equality because the normalizing constant can be tricky to compute. Commented Jan 16, 2020 at 16:58
• Thanks a lot Demetri! Commented Jan 16, 2020 at 17:01

I agree with @Demetri. Baysian inference is based on cause and effect relationship.
$$P(effect|cause)$$ is usually known. Therefore we try to infer $$P(cause|effect)$$.

Remember effect is observable, hence we try to infer the cause given the effect.

$$P(data)$$ is just a normalizing factor which is total $$P(cause)$$.