# Variance of random sum of random variables (conditional distributions)

Question Can you please tell me where I made error in my attempt?

Random variables $X_j$ for $j=1,2,3,...$ are conditionally independent given random variable $\Theta$ and $\mathbb{E}(X|\Theta)=\Theta$, $\mathrm{Var}(X|\Theta)=4\Theta^2$.

Random variable $N$ have conditional distribution $N|\Lambda=\lambda\sim Poisson(\lambda)$.

R.v. $(X_1,X_2,...),N$ are independent.

$\Theta \sim \Gamma(100,2)$ (edited)

$\Lambda \sim \Gamma(2,4)$ (edited)

$\Theta$ and $\Lambda$ are independent.

Calculate variance of $S=\sum_{j=1}^NX_j \qquad$($S=0$ if $N=0$).

Here is my attempt

From given informations I calculate.

$\mathbb{E}X_1=\mathbb{E}(\mathbb{E}(X_1|\Theta))=\mathbb{E}(\Theta)=50$

$\mathbb{E}X_1^2=\mathbb{E}(\mathbb{E}(X_1^2|\Theta))=\mathbb{E}(\mathbb{E}(X_1^2|\Theta)-(\mathbb{E}(X_1|\Theta))^2+(\mathbb{E}(X_1|\Theta))^2)=\mathbb{E}(\mathrm{Var}(X_1|\Theta)+(\Theta)^2)=\mathbb{E}(4\Theta^2+\Theta^2)=5\cdot\frac{(100+100^2)}{4}=12625$

$\mathbb{E}N=\mathbb{E}(\mathbb{E}(N|\Lambda))=\mathbb{E}\Lambda=\frac{1}{2}$

$\mathbb{E}N^2=\mathbb{E}(\mathrm{Var}(N|\Lambda)+(\mathbb{E}(N|\Lambda))^2)=\mathbb{E}(\Lambda+\Lambda^2)=\frac{1}{2}+\frac{2+4}{16}=\frac{7}{8}$

$\mathbb{E}(S)=\mathbb{E}(\sum_{i=1}^NX_i)=\mathbb{E}(N)\mathbb{E}(X_1)=\frac{1}{2}\cdot50$

$\mathbb{E}(S^2)=\mathbb{E}((\sum_{i=1}^NX_i)^2)=\mathbb{E}(\sum_{i=1}^NX_i^2+\sum_{i\neq j}X_iX_j)=(\mathbb{E}N)(\mathbb{E}X_1^2)+\mathbb{E}(N^2-N)(\mathbb{E}X_1)^2=\frac{1}{2}12625+(\frac{7}{8}-\frac{1}{2})\cdot50^2= 7250$

Finally $\mathrm{Var}(S)=\mathbb{E}S^2-(\mathbb{E}S)^2=7250-25^2=6625$

But the correct answer is $6634,375$. I guess I made some illegal step, but I cant find out what is wrong.

Correct answer (Which i understand - but still can't understand what was wrong with my approach)

We calculate first $\mathrm{Var}(S|\Theta)=\mathrm{Var}(N)(\mathbb{E(X_1|\Theta)})^2+\mathbb{E}N\cdot\mathrm{Var}(X|\Theta)=\frac{5}{8}\Theta^2+\frac{1}{2}\cdot4\Theta^2=2,625\Theta^2$

Then use

$\mathrm{Var}(S) = \mathrm{Var}(\mathbb{E}(S|\Theta))+\mathbb{E}(\mathrm{Var}(S|\Theta))=\mathrm{Var}(\frac{1}{2}\Theta)+\mathbb{E}(2,625\Theta^2)=\frac{1}{4}\cdot25+2,625\cdot(100+100^2)/4=6634,375$

The mean of a Gamma Distribution with shape $\alpha$ and rate $\beta$ is $\alpha/\beta$.
So $\mathsf E(\Theta)$ when $\Theta\sim \Gamma(2,4)$ is not $50$, it is $1/2$.
And $\mathsf E(\Lambda)$ when $\Lambda\sim\Gamma(100,2)$ is not $1/2$, it is $50$.
• I am so sorry but I erroneously swapped parameters for $\Theta$ and $\Lambda$ distributions in my question:( I edited my question with correct parameters. Nov 28, 2016 at 10:02