# Absolute error loss for a gamma random variable

Let $X \sim \operatorname{Gamma}(2,1)$, I would like to minimize with respect to $a$ $$E|aX-1|=\int_0^{1/a}(1-ax)xe^{-x}dx+\int_{1/a}^\infty (ax-1)xe^{-x}dx$$

Is there some neat way to do this? The only way I know is to use calculus on the RHS to find the minimum with respect to $a$. By neat, I mean a way that use facts from probability or gamma function? Thanks.

-
What is the expression you get for $a$ when you use calculus on the RHS? – Mike Spivey Sep 30 '11 at 17:48
What is the parameterization you are using for the $\Gamma(2,1)$ random variable. In particular is the second parameter a rate parameter or a scale parameter? At present, it is ambiguous. – cardinal Sep 30 '11 at 18:07
I use $\Gamma(rate,scale)$ for the parametrization. I will add in the post the expression I get for $a$. – Nicolas Essis-Breton Sep 30 '11 at 18:39
@Nicolas: Actually the rate parameter is just the inverse of the scale parameter. So they encode the same quantity. But, in this particular case they are both equal to 1, which is what makes the notation ambiguous even after you've given the density. :) – cardinal Oct 1 '11 at 19:37

(This is a not answer -see Didier's- rather a comment). For $a>0$, $E( | a X - 1 | ) = a E( | X - a^{-1}| )$ so the problem is equivalent to find $b>0$ ($b= 1/a$) that minimizes $$g(b) = \frac{E(|X-b|)}{b} = \frac{h(b)}{b}$$

All we know from "facts from probability" is that the median of $X$ minimizes $h(b)$, but this does not lead to a solution of $g(b)$ (all that we can expect is that the minimum happens for some $b_0 > med(X) \approx 1.67$ ) but this is not very useful (the median of a gamma variable has not a closed form and the bound is not tight)

-
This is a not answer... Well, somebody seems to disagree with you. :-) (But I think your post raises a good point.) – Did Sep 30 '11 at 19:17
I think both of your post excellent. I mark the post of leonbloy as answer, because he elaborates more on the "facts from probability". But, Didier post is very good too. Thanks. – Nicolas Essis-Breton Sep 30 '11 at 19:35

Differentiate $\mathrm E(\,\mid aX-1\mid\, )$ with respect to $a$. The result is $$E(X\,;\,aX>1)-E(X\,;\,aX<1)=E(X)-2E(X\,;\,aX<1).$$ If $X$ is Gamma$(2,1)$, this is zero when $t=1/a$ solves $$t^2+2t+2=\mathrm e^t,$$ that is, for $a=0.374^-$.

-
Didier, how do you get your quadratic? Is there an expression for the limited moment of a gamma distribution? I obtain this quadratic too, but with calculus. – Nicolas Essis-Breton Sep 30 '11 at 19:02
The formula for the derivatire is general. After that, one must plug in the density of the distribution one is interested in, to compute $E(X)$ and $E(X;aX<1)$. I guess you are calling this second step calculus. – Did Sep 30 '11 at 19:05
Didier, just wondering, did you solve the quadratic explicitly? I mean you found a formula for $t$. I think it must be solved numerically. – Nicolas Essis-Breton Sep 30 '11 at 19:59
@NicolasEssis-Breton: Yes, that equation can only be solved numerically (same as the median) wolframalpha.com/input/?i=solve+t%5E2%2B2+t+%2B2+%3D+exp%28t%29 – leonbloy Sep 30 '11 at 21:00