Suppose I have $J \sim$ Bin$(25, P)$, but instead of having fixed $P$, I have a known PDF for continuous $P$, given by $f_{P}(p)$. How would I find $\mathbb{E}[J]$, given this to be the case?


1 Answer 1


You can use ParameterMixtureDistribution(https://reference.wolfram.com/language/ref/ParameterMixtureDistribution.html)

For example:

pmd = ParameterMixtureDistribution[BinomialDistribution[25, p], 
   p \[Distributed] BetaDistribution[q, b]];
Expectation[x, x \[Distributed] pmd]

yields: (25 q)/(b + q)

  • 1
    $\begingroup$ You could also use Mean[pmd] $\endgroup$
    – Bob Hanlon
    Dec 21, 2022 at 5:30
  • $\begingroup$ @BobHanlon yes would have been shorter. Thank you. $\endgroup$
    – ubpdqn
    Dec 21, 2022 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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