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?

  • $\begingroup$ I suppose you want $X$ to be uniform on $1,\ldots,n$ because a binomial distribution with $0$ trials would just be the degenerate random variable $0$. Or are you okay with that? $\endgroup$ – Math1000 Nov 16 '19 at 2:28
  • $\begingroup$ By the way, what this is "called" is that $Y$, conditional on $X=n$ has $\mathrm{Bin}(n,p)$ distribution. With a slight abuse of notation, we can write $Y\mid X=n\sim\mathrm{Bin}(n,p)$. $\endgroup$ – Math1000 Nov 16 '19 at 2:31
  • $\begingroup$ @Math1000 I think 0 trials should be a valid input to the binomial distribution. Of course, in that case the random variable will always be zero, but that's okay. Anyway, it's just an example, and I hope an answer will be generically enough so that I can apply it to arbitrary interval bounds. :) $\endgroup$ – user1494080 Nov 16 '19 at 2:36
  • 1
    $\begingroup$ In that case, $$ \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. I will write this as an answer as well. $\endgroup$ – Math1000 Nov 16 '19 at 2:40

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.

  • $\begingroup$ Thank you, just to be sure I understood the prinicple: Let $W$ be an additional uniform random number in $0..m$ and let $X$ now be uniform in $0..W$. Then the expected value of this chain of three distributions would be $\Sigma_{j=0}^m\Sigma_{k=0}^j E[Y | X = k]P(X=k | W = j)P(W=j) = pm/4$. Is that correct? $\endgroup$ – user1494080 Nov 16 '19 at 3:35
  • $\begingroup$ That should really be asked as a separate question, in my opinion. But I am not sure that your equation holds true. I have never seen such a question so I would have to defer to someone with more expertise, sorry. $\endgroup$ – Math1000 Nov 16 '19 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.