The PDF of the Data (Marginal Likelihood) Given the Prior of a Gamma Distribution with Prior on the $ \beta $ Paraneter Given a model where $ x_i | \beta \sim \mathcal{Gamma} ( \alpha, \beta ) $ where $ \beta \sim \mathcal{Gamma} ( \alpha0, \beta0 ) $, is there a closed form formula for the PDF of $ x_i $?
Namely, what's $ p ( x_i ) $?
In the Gamma Distribution above I assume the shape ($\alpha$) and rate ($\beta$) variant of the Gamma Distribution.
This is similar to a different question I asked (The PDF of the Data Given (Marginal Likelihood) the Likelihood and the Prior of a Normal Distribution with Prior on the Mean) yet with totally different model (This is about the conjugate prior Gamma Gamma model and the other question about the Normal Normal conjugate prior model).
I am using this to build a model of my data (2 different sets in each question).
Please unlock this question.
 A: Yes it does, the Generalized Beta prime distribution  with shape parameter equal to 1.
We can get there fairly easily by integrating $\beta$ out of the joint distribution of $x$ and $\beta$:
$$f(x,\beta|\alpha, \alpha_0, \beta_0) = {\beta^{\alpha}x^{\alpha-1} \over \Gamma(\alpha)}e^{-\beta x}{\beta_0^{\alpha_0}\beta^{\alpha_0-1} \over \Gamma{\alpha_0}}e^{-\beta_0\beta}$$
Rearranging terms and ignoring everything that isn't related to either $\beta$ or $x$ (as they will all be handled by the constant of integration at the end) results in a great deal of simplification:
$$f(x,\beta|\cdot) \propto x^{\alpha-1}\beta^{\alpha+\alpha_0-1}e^{-(\beta_0+x)\beta}$$
We can integrate out $\beta$ easily enough by noting that the two terms involving $\beta$ are those of a Gamma-distributed variate with shape parameter $\alpha + \alpha_0$ and rate parameter $\beta_0 + x$, so the integral must equal the inverse of the constant of integration of such a distribution:
$$x^{\alpha-1}\int \beta^{\alpha+\alpha_0-1}e^{-(\beta_0+x)\beta}\text{d}\beta = {x^{\alpha-1} \Gamma(\alpha+\alpha_0) \over(\beta_0 + x)^{\alpha + \alpha_0}} \propto x^{\alpha-1} (\beta_0 + x)^{-\alpha - \alpha_0}$$
A slight rearrangement of terms and some minor algebra gets us to:
$$f(x|\cdot) \propto \left({x \over \beta_0}\right)^{\alpha-1} \left(1 + {x\over \beta_0}\right)^{-\alpha - \alpha_0}$$
which clearly matches the formula for the GBPD
(with shape parameter $p=1$) as given by Wikipedia and reproduced here:
$$f(x;\alpha,\beta,p,q) = \frac{p \left(\frac x q \right)^{\alpha p-1} \left(1+ \left(\frac x q \right)^p\right)^{-\alpha -\beta}}{qB(\alpha,\beta)}$$
