# Expected value and variance of ratio of two sums of two sets of random variables

Let $X_1,X_2,\ldots,X_n$ be iid $\operatorname{Gamma}(\alpha,\beta)$ random variables. Suppose that, conditionally on $X_1,X_2,\ldots,X_n$, the random variables $Y_1,Y_2,\ldots,Y_n$ are independent and $Y_{i}\mid X_{i}\sim \operatorname{Gamma}(\alpha,\beta X_i)$. Show that $$E\left(\frac{\bar{Y}}{\bar{X}}\right)=\alpha\beta$$ and $$\operatorname{Var}\left(\frac{\bar{Y}}{\bar{X}}\right)=\alpha\beta^2E\left(\frac{\sum X_i^2}{(\sum X_i)^2}\right).$$

It is a question from a past comprehensive exam. The hint says "use the iterated expectation and variance formulas". But I do not see anywhere can use this hint.

• This is as if the author of the exercise was trying hard to hide the fact that $Y_i=X_iZ_i$ where all the random variables $X_i$ and $Z_j$ are i.i.d. Gamma$(a,b)$. With this remark in mind, the rest follows easily, using nothing more than $E(X_i)=E(Z_j)=ab$ and var$(Z_j)=ab^2$ (compare with the accepted answer). – Did Sep 6 '15 at 11:43
• @Did. Do we still need to use iterated expectation and variance formulas? – 81235 Sep 6 '15 at 15:26
• Iterated expectation, if you want to call it this, yes. Iterated variance, no. – Did Sep 6 '15 at 15:28
• @Did. I was trying to use the result "$E(\frac{Y_i}{X_i})=E(Z_i)=ab$" to calculate $E(\frac{\bar{Y}}{\bar{X}})$. But once I use iterated expectation, I did not see where I can use this result. Can you tell me more about which step we can simplify? – 81235 Sep 6 '15 at 15:35
• If $\xi=(X_1,X_2,\ldots,X_n)$ and $U=n\bar X$, then $E(Z_i\mid\xi)=E(Z_i)=ab$ and $E(X_i\mid\xi)=X_i$ for every $i$ hence $$E(\bar X^{-1}\bar Y\mid \xi)=U^{-1}\sum_iE(X_iZ_i\mid\xi)=U^{-1}\sum_iX_iE(Z_i)=U ^{-1}\sum_iX_iab=ab.$$ – Did Sep 6 '15 at 16:31

If $X_i \backsim \operatorname{Gamma}(\alpha,\beta)$ where $\alpha$ is the shape and $\beta$ is the scale parameter then $$\mathbb{E}\left[ X_i \right] = \alpha \beta \quad \quad \mbox{and} \quad \quad \mathbb{V}\mbox{ar}\left[ X_i \right] = \alpha \beta^2$$
From the properties of the gamma distribution $$\overline{X} \backsim \operatorname{Gamma}\left(n \alpha, \beta/n \right)$$ which means $$\mathbb{E}\left[ \bar{X}\right] = \alpha\beta \quad \quad \mbox{and} \quad \quad \mathbb{V}\mbox{ar}\left[\bar{X}\right] = \alpha \beta^2/n$$ Then for $$Y_i | X_i \backsim \operatorname{Gamma}\left(\alpha, \beta X_i \right)$$ $$\mathbb{E}\left[ Y_i | X_i \right] =\alpha \beta X_i \quad \quad \mbox{and} \quad \quad \mathbb{V}\mbox{ar}\left[Y_i | X_i \right] = \alpha (\beta X_i )^2$$
From the law of total expectation we have $$\begin{split} \mathbb{E}\left[\frac{\bar{Y}}{\bar{X}}\right]&= \left. \mathbb{E}\left[ \mathbb{E}\left[ \frac{\bar{Y}}{\bar{X}} \right| X_1, \ldots, X_n \right] \right] \\ &= \mathbb{E}\left[ \frac{1}{\bar{X}} \frac{1}{n} \sum_{i=1}^n\mathbb{E} [ Y_i \big| X_1, \ldots, X_n ] \right] \\ &= \mathbb{E}\left[ \frac{1}{\bar{X}} \frac{1}{n} \sum_{i=1}^n\mathbb{E}[ Y_i \big| X_i ] \right] \\ & = \mathbb{E}\left[ \frac{1}{\bar{X}} \frac{1}{n} \sum_{i=1}^n \alpha \beta X_i \right] \\ & = \alpha \beta \mathbb{E}\left[ \frac{1}{\bar{X}} \frac{1}{n} \sum_{i=1}^n X_i \right] \\ & = \alpha \beta \mathbb{E}\left[ \frac{1}{\bar{X}} \bar{X} \right] \\ & = \alpha \beta \mathbb{E}\left[ 1 \right] \\ & = \alpha \beta \\ \end{split}$$