# Finding the posterior distribution, several priors

Bayes' rule $$\pi(\theta|y)\propto\pi(y|\theta)\pi(\theta)$$ gives the posterior distribution. However for the first time I have encountered a problem where I have two parameters (because the likelihood function is a gamma distribution), $\alpha$ and $\beta$.

• I know the likelihood function (a gamma distribution).
• I know the distribution for $\beta$ given that $\alpha$ is known (a gamma distribution).
• I know the distribution of $\alpha$ (an exponential distribution).
• I have data $y$.

The goal is to find the posterior distribution. In general, how do I approach a problem like this? How can I find the the prior when the prior is given as two separate distributions and one depends on the other?

## 1 Answer

You can use the product rule $P(A, B) = P(A) P(B | A)$ to figure this out.

Take your model above. You can start with the joint distribution over everything and expand it recursively until you have everything you need:

\begin{align*} \underbrace{\pi(y, \alpha, \beta)}_{\text{joint distribution}} & = \underbrace{\pi(y \, | \, \alpha, \beta)}_{\text{likelihood}} \underbrace{\pi(\alpha, \beta)}_{\text{prior}} \\ & = \pi(y \, | \, \alpha, \beta) \underbrace{\pi(\beta \, | \, \alpha)}_{\text{gamma}} \underbrace{\pi(\alpha)}_{\text{exponential}} \end{align*}

You can similarly expand the left-hand side into $\pi(\alpha, \beta \, | \, y) \pi(y)$, and then dividing everything by the latter term gives you Bayes' theorem.