# Some expectation values for a Gamma distribution

Assuming I have a Gamma distributed random Variable $x \sim Gamma( \alpha, \beta )$. Now I like to have the following two expectation values (integrals):

1. $E \left[ x \ln x \right]$
2. $E \left[ \ln \Gamma \left( x \right) \right]$ with $\Gamma \left( x \right)$ being the Gamma function

-
At least at first glance, the second integral seems quite complicated, considering the expressions for the Log Gamma Function (see, for example, mathworld.wolfram.com/LogGammaFunction.html). –  Shai Covo Feb 10 '11 at 3:42

First integral. $X$ has density function $$f(x;\alpha ,\beta ) = \frac{{\beta ^\alpha }}{{\Gamma (\alpha )}}x^{\alpha - 1} e^{ - \beta x},\;\; x > 0,$$ with $\alpha,\beta > 0$ fixed. It follows readily from $$\Gamma '(\alpha ) = \int_0^\infty {x^{\alpha - 1} e^{ - x} \ln x\,{\rm d}x}$$ and $$\Gamma '(\alpha ) = \Gamma (\alpha )\psi _0 (\alpha ),$$ where $\psi_0$ is the digamma function, that $${\rm E}[X\ln X] = \frac{{\beta ^\alpha }}{{\Gamma (\alpha )}}\int_0^\infty {(x\ln x)x^{\alpha - 1} e^{ - \beta x} dx} = \frac{\alpha }{\beta }[\psi_0 (\alpha + 1) - \ln \beta ].$$

EDIT: Elaborating (in response to the OP's request).

First, you can find here the above formulas for $\Gamma'(\alpha)$. Now, using a change of variable, we have $$\Gamma'(\alpha+1) = \int_0^\infty {\beta ^{\alpha+1} x^{\alpha} e^{ - \beta x} \ln (\beta x)\,{\rm d}x} = \ln \beta \int_0^\infty {\beta ^{\alpha+1} x^{\alpha} e^{ - \beta x} \,{\rm d}x} + \int_0^\infty { \beta ^{\alpha+1} x^{\alpha} e^{ - \beta x} \ln x\,{\rm d}x}.$$ The first integral on the right-hand side is equal to $\Gamma(\alpha+1)\ln \beta$, and the second integral to $\Gamma(\alpha)\beta {\rm E}[X\ln X]$. It thus follows that $$\Gamma (\alpha + 1)\psi _0 (\alpha + 1) = \Gamma (\alpha + 1)\ln \beta + \Gamma (\alpha )\beta {\rm E}[X\ln X].$$ Finally, by $\Gamma(\alpha+1)=\alpha \Gamma(\alpha)$, we get $${\rm E}[X\ln X] = \frac{\alpha }{\beta }[\psi_0 (\alpha + 1) - \ln \beta ].$$

-
Thank you very much! Can you give a hint, how you came to you solution? For me this is not clear... Do you have an idea about the other integral? –  Matthias Feb 9 '11 at 14:30

1. E(XlnX)=(formula of expectation, group x) =E(lnY) with Y~gamma(alpha+1,beta)

E(lnY)=ψ(alpha+1)-ln(beta) where ψ(k) is the digamma function.

-
wow. Really? Statistical manipulations are so inscrutable. How do you go about figuring out those answers? –  Mitch Feb 9 '11 at 1:59
Hi! Thanks for your answer. But it looks like you are wrong. I sampled gamma distributed data and compared your answer, the answer of Shai Covo and the sampled expectation value. Your formula is quite far away from the sampled. However the one of Shai Covo is very close. –  Matthias Feb 9 '11 at 14:26
yep, i was wrong, i forget to include de alpha/beta factor. –  Sebastian Vallejo Feb 10 '11 at 5:15