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
$\begingroup$
$\endgroup$
2
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$ @BobHanlon yes would have been shorter. Thank you. $\endgroup$– ubpdqnCommented Dec 21, 2022 at 7:22