11
$\begingroup$

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?

$\endgroup$
  • 1
    $\begingroup$ 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. $\endgroup$ – Xi'an Oct 23 '12 at 8:44
13
$\begingroup$

Write the densities with the indicators to have a clear picture.

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 \, . $$

$\endgroup$
  • 2
    $\begingroup$ This is a good answer, but maybe you should parameterize the Gamma distribution in the same way as the original question. $\endgroup$ – assumednormal Oct 23 '12 at 0:22
  • $\begingroup$ Good point, Max. Done. $\endgroup$ – Zen Oct 23 '12 at 0:27
  • $\begingroup$ Woops, my own definitions had bugs. Should be $\alpha = k$. $\endgroup$ – duckworthd Oct 23 '12 at 1:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.