# marginal and conditional distributions

Can someone help me, please? Let X and Y be two random variables having the following marginal and conditional distributions. π|π ~ πππ(π) π ~ πΊππππ(πΌ, π½) I want to obtain the distribution of Y.

$$P[Y = k \,|\, \mu] = \frac{\mu^k e^{-\mu}}{k!} ,\;\; f(\mu) = \frac{\beta^\alpha}{\Gamma(\alpha)} e^{-\beta \mu}{\mu^{\alpha - 1}} ,$$ where $$f(\cdot)$$ is the density of $$\mu$$. To find the marginal distribution of $$Y$$, you need to calculate $$P[Y = k]$$, which is $$E[P[Y = k \,|\, \mu]]$$. Therefore,
\begin{align} P[Y = k] = E[P[Y = k \,|\, \mu]] &= \int P[Y = k \,|\, \mu] f(\mu) d\mu \\ &= \int_{0}^{\infty} \frac{\mu^k e^{-\mu}}{k!} \frac{\beta^\alpha}{\Gamma(\alpha)} e^{-\beta \mu}{\mu^{\alpha - 1}} d\mu \\ &= \frac{\beta^\alpha}{k! \Gamma(\alpha)} \int_{0}^{\infty} e^{-(\beta + 1) \mu} {\mu^{\alpha + k - 1}} d\mu \\ &= \frac{\beta^\alpha}{k! \Gamma(\alpha)} \frac{\Gamma(\alpha + k)}{(\beta + 1)^{(\alpha + k)}} \\ &= \frac{\Gamma(\alpha + k)}{k! \Gamma(\alpha)} \left( \frac{\beta}{1+\beta} \right)^{\alpha} \left( \frac{1}{1+\beta} \right)^{k} . \end{align}
So, $$Y$$ follows the negative binomial distribution with parameters $$\alpha$$ and $$\frac{\beta}{1+\beta}$$.