Marginal densities from joint of beta and gamma Say we have $X|\theta \sim \mathrm{beta} (\theta , 1)$ and $\theta \sim \exp(1)$
How would one go about to find the marginal density of X?
I find that the joint distribution of $(X, \theta)$ is $f(x , \theta) = \theta x^{\theta - 1} e^{- \theta}$.
From here $\int_0^{\infty}f(x , \theta) d\theta$ does not seem like the most efficient way to proceed.
Any hints as to how one can move forward?
Thank you for the insight!
 A: $$
\int_0^\infty \theta x^{\theta - 1}e^{-\theta}\,\text d\theta = \frac 1x  \int_0^\infty  \theta \left(\frac 1x\right)^{-\theta}e^{-\theta}\,\text d\theta
$$
$$
= \frac 1x  \int_0^\infty  \theta \left(\frac ex\right)^{-\theta}\,\text d\theta = \frac 1x \int_0^\infty  \theta e^{-\alpha\theta}\,\text d\theta
$$
where $\alpha = 1 - \log x$. Can you finish the integral?

More generally, let $\theta \sim \text{Gamma}(a, b)$ so $f(\theta) = \frac{b^a}{\Gamma(a)} \theta^{a - 1} e^{-b \theta}$. Then we have
$$
f_X(x) = \frac{b^a}{\Gamma(a)} \int_0^\infty \theta^a  x^{\theta - 1} e^{-b \theta}\,\text d\theta
$$
$$
 = \frac{b^a}{x\Gamma(a)} \int_0^\infty \theta^a  \left(\frac{e}{x^{1/b}}\right)^{-b \theta}\,\text d\theta
$$
where $x \geq 0$ guarantees that $x = (x^{1/b})^b$. Then
$$
f_X(x) = \frac{b^a}{x\Gamma(a)} \int_0^\infty \theta^a  e^{-\gamma  \theta}\,\text d\theta
$$
where now $\gamma = b(1 - \frac 1b \log x)$. This integral is also quite tractable -- you can get a reasonably tidy form out of this with a little simplification (in particular, notice how close it is to a gamma function).

Since you've solved the problem yourself I'm going to post the rest of my solution for the general case.
We have 
$$
f_X(x) = \frac{b^a}{x\Gamma(a)} \int_0^\infty \theta^a  e^{-\gamma  \theta}\,\text d\theta = \frac{b^a}{x\Gamma(a)} \cdot \frac{\Gamma(a+1)}{\gamma^{a+1}}.
$$
Using the property of $\Gamma$ that $\Gamma(z + 1) = z \Gamma(z)$ and substituting the value of $\gamma$ back in, we find
$$
f_X(x) = \frac{a}{bx(1 - \frac 1b \log x)^{a+1}}.
$$
As a sanity check, let's integrate this and see if it's equal to $1$. $\newcommand{\d}{\, \text d}$
$$
\int_0^1 f_X(x) \d x = \frac ab \int_0^1 \frac{\d x}{x (1 - \frac 1b \log x)^{a+1}}.
$$
Letting $t = 1 - \frac 1b \log x$ we have
$$
\int_0^1 f_X(x) \d x = a \int_1^\infty t^{-a-1}\d t = -t^{-a} \big\vert_{1}^\infty =1
$$
(where $a>0$ is essential for convergence) so it looks like we got it right.
