# Density of Y = log(X) for Gamma-distributed X

This question is closely related to this post

Suppose I have a random variable $X \sim \text{Gamma}(k, \theta)$, and I define $Y = \log(X)$. I would like to find the probability density function of $Y$.

I had originally thought I would just define cumulative distribution function X, do a change of variable, and take the "inside" of the integral as my density, like so,

\begin{align} P(X \le c) & = \int_{0}^{c} \frac{1}{\theta^k} \frac{1}{\Gamma(k)} x^{k- 1} e^{-\frac{x}{\theta}} dx \\ P(Y \le \log c) & = \int_{\log(0)}^{\log(c)} \frac{1}{\theta^k} \frac{1}{\Gamma(k)} \exp(y)^{k- 1} e^{-\frac{\exp(y)}{\theta}} \exp(y) dy \\ \end{align}

Here I use $y = \log x$ and $dy = \frac{1}{x} dx$, then sub in definitions for $x$ and $dx$ in terms of $y$.

The output, unfortunately, does not integrate to 1. I'm not sure where my mistake is. Could some tell me where my error is?

• If you work through the cdf, you should not change the integrand from the first to the second integral. Your mistake is in trying to use both the cdf and the Jacobian approaches at the same time. Oct 23 '12 at 8:44

If $X\sim\mathrm{Gamma}(k,\theta)$, then $$f_X(x) = \frac{1}{\theta^k \Gamma(k)} \;\; x^{k-1} e^{-x/\theta} \, I_{(0,\infty)}(x) \, .$$
If $Y=g(X)=\log X$, with inverse $X=h(Y)=e^Y$, then $$f_Y(y) = f_X(h(y)) |h'(y)| = \frac{1}{\theta^k\Gamma(k)} \;\; \exp\left( ky-e^y/\theta\right)\,I_{(-\infty,\infty)}(y) \, ,$$ and the CDF is obtained from the definition $$P(Y\leq y) = \int_{-\infty}^y f_Y(y) dy \, .$$
• Woops, my own definitions had bugs. Should be $\alpha = k$. Oct 23 '12 at 1:15