Given a simple case of say 2 independent trials each with probability of success 1/3. Consider a random variable that is gives the 3 times the total successes.

We can define this random variable in terms of predefined distributions by simply setting it as 3 x BinomialDistribution[2,1/3].

I want to calculate the expected value of this variable given atleast one success which I try to calculate as follows:


But this gives a weird answer


Even if i remove the zeros of this distribution its mean cannot be larger than the max value of the variable which is 6 in this case.

The answer I expect can be achieved using:


So the TransformedDistribution is bugging right?


enter image description here

Both are producing the same crazy PDF, there are no Boole[...] to set non-integer values to zero.

  • $\begingroup$ Yeah I think it is bugging indeed, perhaps you can use: Expectation[3 x [Conditioned] (x > 0), x [Distributed] BinomialDistribution[2, 1/3.]] $\endgroup$ – SHuisman Sep 14 at 19:58
  • 1
    $\begingroup$ @JimB - it sums to 1 for what should be the support, but sums to >1 over the range. $\endgroup$ – ciao Sep 15 at 3:35
  • 1
    $\begingroup$ @ciao You are correct. But if I can offer a feeble defense: Sum[PDF[d, z], {z, 0, n}] sums to 1 for any finite value for n. It only chokes when one plugs in $\infty$. $\endgroup$ – JimB Sep 15 at 3:41
  • 2
    $\begingroup$ @JimB - it gets weirder. zz = PDF[dist, x]; {Sum[zz, {x, 0, 6}] // N, Sum[PDF[dist, x], {x, 0, 6}] // N} returns {2.58266,1.}. $\endgroup$ – ciao Sep 15 at 3:48
  • 2
    $\begingroup$ @ciao. Wow! It does indeed get weirder! Sum[zz, {x, 0, 6, 3}] gives 1 but Sum[zz, {x, 0, 6, 1}] gives 2.58266. Also, zz := PDF[dist, x]; Sum[zz, {x, 0, 6}] // N gives 1. $\endgroup$ – JimB Sep 15 at 4:03

Your Answer

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

Browse other questions tagged or ask your own question.