X|Y~Binomial(Y,p), Y|Z~Poisson(Z), Z~exponential(b),where p and b are constants. What is the E(X) and Var (X)
My way to solve it to to find the joint pdf of (Y|Z) and Z so we can have the marginal (unconditionally)Y. Similar get the marginal of X to get the E(X) and VAR(X). Is there a simpler way to solve it?
From the formulas $\mathbb{E}(\mathrm{Bin}(n,p)) = np$ and $\mathbb{V}\mathrm{ar}(\mathrm{Bin}(n,p)) = np(1 - p),$ you can get that $\mathbb{E}(X\mid Y) = Yp$ and $\mathbb{V}\mathrm{ar}(X\mid Y) = Yp(1 - p).$ Henceforth, $\mathbb{E}(X) = \mathbb{E}(Y)p$ and $\mathbb{V}\mathrm{ar}(X) = \mathbb{V}\mathrm{ar}(Y)p^2(1 - p)^2.$ Suffices to find $\mathbb{E}(Y)$ and $\mathbb{V}\mathrm{ar}(Y).$ Similarly, $\mathbb{E}(Y\mid Z) = Z,$ so $\mathbb{E}(Y) = \dfrac{1}{b}.$ To calculate $\mathbb{V}\mathrm{ar}(Y)$ one needs to be a bit careful, $\mathbb{V}\mathrm{ar}(Y) = \mathbb{E}(Y^2) - \mathbb{E}(Y)^2 = \mathbb{E}(Y^2) - \dfrac{1}{b^2}$ and $\mathbb{E}(Y^2) = \mathbb{E}(\mathbb{E}(Y^2\mid Z)) = \int\limits_0^\infty dz \mathbb{E}(Y^2\mid Z=z) be^{-bz}$, and since $Y\mid Z=z \sim \mathrm{Pois}(z),$ it follows that $\mathbb{E}(Y^2\mid Z=z) = z + z^2,$ whence $\mathbb{E}(Y^2) = \int\limits_0^\infty dz (z + z^2)be^{-bz} =\dfrac{1}{b} + \dfrac{2}{b^2}.$ Substitute back and you get all you wanted.