# What is the problem in my CDF derivation?

Let $$Z = \frac{XY}{aX+bY+c}$$ where the random variable $$X$$ and $$Y$$ follows gamma distribution such that

$$X\sim G(\lambda_x,\theta_x)$$ and $$Y\sim G(\lambda_y,\theta_y)$$

The CDF of $$Z$$ can be evaluated as \begin{align} F_Z(z)&=\Pr\bigg\{ \frac{XY}{aX+bY+c}\leq z\bigg\}\\ &=\int_{y=0}^{\infty}\Pr\bigg\{X\leq \frac{bzy+cz}{y-az}\bigg|Y=y\bigg\}f_y(y)dy\\ &=\int_{y=0}^{az}\Pr\bigg\{X\leq \frac{bzy+cz}{y-az}\bigg|Y=y\bigg\}f_y(y)dy\\ &+ \int_{y=az}^{\infty}\Pr\bigg\{X\geq \frac{bzy+cz}{y-az}\bigg|Y=y\bigg\}f_y(y)dy\\ &=\int_{y=0}^{az}f_y(y)dy + \int_{y=az}^{\infty}\Pr\bigg\{X\geq \frac{bzy+cz}{y-az}\bigg\}f_Y(y)dy\\ &=\int_{y=0}^{az}f_Y(y)dy + \int_{y=az}^{\infty}\overline{F}_X\bigg(\frac{bzy+cz}{y-az}\bigg)f_Y(y)dy\\ \end{align}

On substituting $$t = y-az$$ in above equation. Where $$\overline{F}_X = 1 - F_X(x)$$ is complimentary CDF, and $$F_X(x)$$ and $$f_Y(y)$$ is defined as

$$\begin{equation} f_Y(y) = \frac{\theta_y^{\lambda_y}}{\Gamma(\lambda_y)}y^{\lambda_y-1}e^{-\theta_y y} \end{equation}$$ $$\begin{equation} F_X(x)=\frac{\gamma(\lambda_x,\theta_x x)}{\Gamma(\lambda_x)}\\ \end{equation}$$

The CDF of gamma distribution can also be written as in Wikipedia for $$\lambda_x$$ to be integer.

$$\begin{equation} F_X(x)=1-e^{-\theta_x x}\sum_{p=0}^{\lambda_x - 1}\frac{(\theta_x x)^p}{p!} \end{equation}$$

On substituting respective CDF and PDF in above equation. \begin{align} F_Z(z) &= 1 - \int_{0}^{\infty}\overline{F}_X\bigg(\frac{abz^2+cz}{t}+bz\bigg)f_Y(az+t)dt\\ &= 1-\frac{\theta_y^{\lambda_y}e^{-\theta_y az}}{\Gamma(\lambda_y)}\sum_{p=0}^{\lambda_x-1}\frac{1}{p!}\int_{0}^{\infty}\bigg(\theta_x bz + \frac{\phi}{t}\bigg)^p(az+t)^{\lambda_y-1}\exp\bigg(- \frac{\phi}{t}-\theta_y t\bigg) dt\\ \end{align} Where $$\phi = \theta_x(abz^2+cz)$$. In above integral expanding first and second integrand from [1.111,pp 25] as \begin{align} \bigg(\theta_x bz + \frac{\phi}{t}\bigg)^p&=\sum_{q=0}^{p}{p\choose q}\bigg(\frac{\phi}{t}\bigg)^q(\theta_x bz)^{p-q}\\ (az+t)^{\lambda_y-1}&=\sum_{r=0}^{\lambda_y-1}{\lambda_y-1\choose r}t^r(az)^{\lambda_y-1-r} \end{align} and collecting terms containing $$t$$. Thus the integral can be written as \begin{align} I &= \int_{0}^{\infty}\bigg(\theta_x bz + \frac{\phi}{t}\bigg)^p(az+t)^{\lambda_y-1}\exp\bigg(- \frac{\phi}{t}-\theta_y t\bigg) dt\\ &=\sum_{q=0}^{p}\sum_{r=0}^{\lambda_y-1}{p\choose q}{\lambda_y-1\choose r}\phi^q(\theta_x bz)^{p-q}(az)^{\lambda_y-1-r}\int_{0}^{\infty}t^{r-q}\exp\bigg(- \frac{\phi}{t}-\theta_y t\bigg) dt\\ \end{align} On using identity from [3.471.9,pp 370] solving the integral and after some algebraic manipulation the CDF of $$Z$$ is given by \begin{align} F_Z(z) &= 1-2\frac{\theta_y^{\lambda_y}}{\Gamma(\lambda_y)}\sum_{p=0}^{\lambda_x-1}\sum_{q=0}^{p}\sum_{r=0}^{\lambda_y-1}\frac{1}{p!}{p\choose q}{\lambda_y-1\choose r}A\bigg(\frac{c}{ab}+z\bigg)^{(r+q+1)/2}\\ &\times z^{\lambda_y+p-(r-q-1)/2}e^{-\theta z}K_{r-q+1}\bigg(2\sqrt{\theta_x\theta_y(abz^2+cz)}\bigg) \end{align}

Where $$\theta = \theta_x b + \theta_y a$$ and $$A = \theta_x^{p+(r-q+1)/2}\theta_y^{-(r-q+1)/2}a^{\lambda_y-(r-q+1)/2}b^{p+(r-q+1)/2}$$.

I tried simulating the random variable $$Z$$ in MATLAB and while validating with analytical result which I obtained doesn't seems to agree for small value of $$z$$. Here is the code for the analytical expression of CDF in MATLAB.

function F = SNRcdf(z,a,b,c,thetaa,thetab,lambdaa,lambdab)

A = 2*(thetab^lambdab)/gamma(lambdab);
expf = exp(-(thetaa*b + thetab*a)*z);

I = 0;
for p = 0:(lambdaa - 1)
for q = 0:p
for r = 0:(lambdab - 1)
M1 = (1/factorial(p))*nchoosek(p,q)*nchoosek(lambdab - 1,r);
M2 = (thetaa*b*z).^(p-q);
M3 = (a*z).^(lambdab - r - 1);
M4 = (thetaa*(a*b*z.*z + c*z)).^q;
M5 = (thetaa*(a*b*z.*z + c*z)./thetab).^((r - q + 1)/2);
K = besselk(r - q + 1,2*sqrt(thetaa*thetab*a*b*c*z.*z + thetaa*thetab*c*z));
I = sum(M1.*M2.*M3.*M4.*M5.*K) + I;
end
end
end

F = 1 - A*expf*I;

• Your analysis is impressive--but it suffers from overuse (IMHO) of a powerful computer algebra system. You will increase the chance of obtaining a correct and insightful answer by preliminary simplification. In particular, because $aX\sim\Gamma(\lambda_x,\theta_x/a)$ and $bY\sim\Gamma(\lambda_y,\theta_Y/b),$ the distribution of $cZ$ depends only on the parameters $\theta_x/a,$ $\theta_y/b,$ $\lambda_x,$ and $\lambda_y.$ Working out the PDF for $Z$ in simple special cases suggests your answer is basically right, but makes me wonder whether the factor of $e^{-\theta z}$ is correct. – whuber Jan 26 '19 at 18:58
• @whuber Thanks for pointing out and have corrected the factor of $e^{-\theta z}$. But I didn't get about "but it suffers from overuse (IMHO) of a powerful computer algebra system" – Meet Jan 26 '19 at 19:17
• When you have to keep track of seven parameters instead of four, you multiply the risk of making a single minor error by at least that ratio--and probably much more, due to the increased complexity of every expression you write down. When things get complicated and getting the right answer matters, you should have a burning desire to simply the problem as much as possible before you go to all that algebraic work. Typically, you--not the computer algebra system--will have to do that simplification, because it's perfectly happy to crank away at whatever you present it. – whuber Jan 26 '19 at 19:22
• In several places you had $F_y(y)$ instead of $F_Y(y).$ I fixed that and also did some lesser routine copy-editing corrections. – Michael Hardy Jun 15 '19 at 20:42