Expected value of “composite” probability distributions

expected valueprobabilityprobability distributions

Let $X$ be a uniform random number in $0..n$. Its expected value is $n/2$.

Next, let $Y$ obey a binomial distribution with $X$ trials and success probability $p$. So now we have a distribution where one of the parameters is itself a random variable. I'm not sure how this is called, but it reminds me of composite functions.

Can I compute the expected value of $Y$ simply as $X\cdot p$, and subsitute $n/2$ for $X$, yielding an expected value of $np/2$ for $Y$? If not, how do we compute the expected value of a distribution that has a parameter that is a random variable itself?

Best Answer

By the law of total expectation we compute $$ \mathbb E[Y] = \sum_{k=0}^n \mathbb E[Y\mid X=k]\mathbb P(X=k) = \sum_{k=0}^n kp\cdot\frac1{n+1} = \frac{np}2, $$ as expected.

Related Question