TITLE: Mean of an Exponential Distribution whose rate parameter is also exponentially distributed
QUESTION [6 upvotes]: Suppose I have a random variable $X$ with an exponential distribution with rate parameter $\lambda$. Suppose also that I don’t know the value of $\lambda$ but that it will be drawn from another exponential distribution with rate parameter $K$. I’m trying to figure out what my expected value for $X$ is in terms of $K$. The integral as I understand it seems to be $\int \frac{Ke^{-Kx}}{x}$
Playing around it seems as though setting $K = 1$ gives $X$ a mean of the Exponential Integral function $\mathrm{Ei}(0)$ (please correct me if this is wrong), but I’m not familiar enough with this function to understand how changing $K$ affects this output
In particular, setting $K = 2$ seems to yield
$\int \frac{2e^{-2x}}{x} = 4\int \frac{e^{-2x}}{2x} = 4 \mathrm{Ei}(0)$
Which intuitively seems wrong as increasing the rate parameter should decrease the mean. Clearly I’m doing something very stupid here but would appreciate pointers! Thanks

REPLY [5 votes]: The expected value can be computed using the law of total expectation. $X$ given $\Lambda=\lambda$ is distributed as $\mathrm{Exp}(\lambda)$ and $\Lambda$ is distributed as $\mathrm{Exp}(K)$. Since the conditional expecation $E[X|\Lambda=\lambda] = \frac{1}{\lambda}$ We obtain
$$ E[X] = E[E[X|\Lambda]] = \int_0^\infty \frac{K\mathrm{e}^{-K\lambda}}{\lambda}d\lambda,  $$
as the OP noted. The only step left to be made is a variable substitution in the integral $\mu=K\lambda$ to obtain
$$ E[X] = \int_0^\infty \frac{K\mathrm{e}^{-\mu}}{\mu}d\mu = K\cdot \mathrm{Ei}(0),  $$
where $\mathrm{Ei}(z)$ is the exponential integral. Thus, $E[X]$ is indeed increasing in $K$. Loosely speaking, this is because larger $K$, means smaller $\Lambda$, means larger $X$.