Mean and Var of a gamma distribution Let X have a Gamma distribution with a known scale
parameter 1, but an unknown shape parameter, that itself is random,
and has the standard exponential distribution. 
How do I compute the mean and the variance of X?
Thanks!
 A: If we call the unknown parameter $\theta$, then what you are seeking is
$$
E(X)=\int_0^\infty x f(x)dx=\int_0^\infty x \int_0^\infty f(x, \theta)d\theta dx=\int_0^\infty x\int_0^\infty f(x|\theta)f(\theta)d\theta dx
$$
where then it is given that 
$$
\begin{align*}
x|\theta&\sim Gamma(1, \theta)\\
\theta&\sim Exp(1)
\end{align*}
$$
meaning that you can multiply them together and integrate out $\theta$ and then you have the marginal distribution of $x$. 
As pointed out in a comment to the original post, you can also use iterated expectations.
$$
\begin{align*}
E(X)&=E_\theta(E_{X|\theta}(X|\theta))\\
V(X)&=E_\theta (V_{X|\theta}(X|\theta))+V_\theta (E_{X|\theta}(X|\theta))
\end{align*}
$$
To illustrate what this means, the expectation is thus
$$
E(X)=E_\theta(E_{X|\theta}(X|\theta))=E_\theta(\theta)=1
$$
since the expectation of a $Gamma(1, \theta)$ distribution is $1\times\theta$ (i.e. $E_{X|\theta}(X|\theta)=\theta$). Since $\theta$ is Exp(1), its expectation is in turn 1. For the variance, you do the same thing.
