# Bayesian Statistics: Marginal Posterior

In a hierarchical model, the prior $\pi(\theta\mid\xi)$ for $\theta$ depends on hyperparameters $\xi$.

In my lecture notes, the following is now given:

$$\pi(\xi \mid x) = { \pi(\theta,\xi\mid x)\over \pi(\theta\mid x,\xi)}.$$

I don't see how to derive this formula.

• Note that you can get nicer spacing around the vertical bars in conditional probabilities by using \mid instead of |. – joriki Jul 17 '18 at 18:56
• oh wow! didn't know this, it indeed looks so much better this way! thank you :) – Protawn Jul 17 '18 at 18:59

$$\frac{\pi(\theta,\xi\mid x)}{\pi(\theta\mid x,\xi)}=\frac{\pi(\theta,\xi,x)}{\pi(x)}\cdot\frac{\pi(x,\xi)}{\pi(\theta,\xi,x)}=\frac{\pi(x,\xi)}{\pi(x)}=\pi(\xi\mid x)\;.$$