# Product and division of gamma distributions

SHORT VERSION: how would I go about solving the following inverse problem:

$F(a,a_v,b,b_v,c,c_v)=\frac{A B}{C}$ where $A,B,C$ are gamma distributed according to A's mean=$a$, A's variance=$a_v$, etc. I'd like to determine the gamma distribution shape parameters from the shape of $F$.

LONG VERSION:

I have an output probability distribution function $F$ which is produced by taking a simple equation $\frac{a b}{c}$ and varying each of those constants according to a gamma distribution. For simplicity, I can assume that these distributions are independent of each other, though I'd be interested in the case where they are not.

Numerically, it is simple to generate $F$. I randomly select a value $a_i$ from a gamma distribution with mean=$a$ and variance=$a_v$. I do the same with $b$ and $c$. Then I compute and record $F_i=\frac{a_i b_i}{c_i}$. I do this many times until I have enough $F_i$'s to build a histogram, and ultimately the PDF of $F$ which is a function of 6 parameters, the three means and three variances of the gamma distribution inputs.

The problem is that I'm trying to derive the means and variances of the input gamma distributions from the output distribution. I've searched extensively, and have not found anyone with a close-formed result for the PDF of the product / division of gamma distributions. Is it possible to derive these functions?

Alternatively, is it possible to derive moments of the $F$ as a function of the gamma distribution parameters? This would be almost as helpful.

OPTIONAL BACKGROUND One reason I'd love to work these out analytically is that, for example, it's clear to me that there are multiple, or even an infinite number of child gamma distributions that can produce one $F$. Fortunately, I have more information about my system to help determine the parameters. Unfortunately, numerical solvers are very unhappy when the "solution" is a plane or line rather than being discrete minima. If I could set constraints on the system analytically, it would be very helpful.

-

In general, the distribution of the product of Gammas is quite complicated. See the following paper, http://www.jstor.org/stable/2099424. I would imagine that the distribution of AB/C is far more complicated even with independence.

If you want a functional relationship between the moments of F and A,B, and C, then this is a lot more straight forward. If you assume independence, then the k-th moment of F is simply

$E(F^k) = E(A^k)E(B^k)E(C^{-k})$

for which, each of these are well known for the gamma distribution.

In principle, you may be able to solve for the parameters with something like method of moments (if you have observed data) or just invert numerically with the true moments, but I'm not sure how good it will be.

EDIT There is an unfortunate definite answer for you. The parameters of F are unidentifiable. In other words, you can not uniquely solve for the 6 parameters in a single way.

First note that the gamma distribution is closed under scalar multiplication. So if $X$ is gamma then $aX$ is gamma, $a > 0$.

Let $u,v, w$ be positive constants then if $uv/w = 1$.

$F = AB/C = uv/w AB/C = (uA) (vB) / (wC)$

So you need to put constraints in order to solve this problem uniquely.

-
I'm not sure I agree with that moment equation. I actually know for a fact that if I increase the variance of each of my gammas while keeping their expectations the same, the expectation of F changes. So that relationship does not appear to be correct! Will take a look at that article you mentioned. – vector07 Sep 27 '12 at 22:00
I can assure you it is correct and follows from the fact that if random variables are independent, then $E(\prod g_i(X_i)) = \prod E(g_i(X_i))$ provided the expectations exist. My guess is that if the expectation is changing when you change the variance, you are mistakenly specifying the parameters in your simulation. – W. Volterman Sep 27 '12 at 22:09
It should be pointed out that, the above expectation involves $E(C^{-k})$ (note the inverse power), so if the variance of $C$ changes, then it definitely could change the expectation of $F$ (but not if the variance of $A$ or $B$ change.) – W. Volterman Sep 27 '12 at 22:18
This latter point must be the problem. I have not varied each one individually, but when I increase the variance of all three, maintaining the same mean, the expectation of F changes. It is not a problem in 'specifying the parameters' in my sim. Also, the paper you cited comes close, but it appears they assume a theta shape parameter of 1 in common with all the gamma distributions being multiplied. In my situation, unfortunately both shape parameters vary quite dramatically between gamma distributions. Good find though. – vector07 Sep 27 '12 at 23:46
Yeah. Try changing only the variances of A and B and fixing everything else, the expectation should remain constant. Note that 1/C has inverted gamma distribution, so you can work with that distribution directly if it makes your life easier. – W. Volterman Sep 27 '12 at 23:52