3
$\begingroup$

I am having trouble with this Mathematica command:

 Probability[ x + y + z > 14, {x, y, z} \[Distributed] 
 ProductDistribution[{DiscreteUniformDistribution[{1, 6}], 3}]]`

outputs 5 / 54. What I would like to do is use the EmpiricalDistribution sort of like this:

 Probability[x + y + z > 14, {x, y, z} \[Distributed]
 ProductDistribution[{EmpiricalDistribution[{1, 2, 3, 4, 5, 6}], 3}]]

of course, that does not work and just spits out the command. How can I get the Empirical Distribution to work like that?

$\endgroup$
  • 1
    $\begingroup$ Does this do what you want? Probability[ x + y + z > 14, {x, y, z} \[Distributed] EmpiricalDistribution[{1, 2, 3, 4, 5, 6}] // Thread] $\endgroup$ – Rojo Jan 15 '14 at 18:38
  • $\begingroup$ Hi Rojo; Yes, that seems to work fine. Thanks. $\endgroup$ – bobbym Jan 15 '14 at 18:41
4
$\begingroup$

This is a possibility

Probability[
    x + y + z > 14, 
   {x, y, z} \[Distributed] 
        EmpiricalDistribution[{1, 2, 3, 4, 5, 6}] // Thread
 ]
$\endgroup$
  • $\begingroup$ that's very interesting. I don't understand what the Thread is doing. Threading the EmpiricalDistribution gives: {DataDistribution["Empirical", {1/6, 1/6, 1/6, 1/6, 1/6, 1/6}, 1, 6], DataDistribution["Empirical", {1, 2, 3, 4, 5, 6}, 1, 6], DataDistribution["Empirical", False, 1, 6]}. Only the middle one of these seems to make sense. $\endgroup$ – bill s Jan 15 '14 at 20:22
  • $\begingroup$ @bills, the EmpiricalDistribution by itself evaluates to the DataDistribution. Here I am not threading the EmpiricalDistribution but the whole Distributed[{x,y,z},Emp...] (check the precedences). So, just like f[{a, b, c}, 2] // Thread gives {f[a, 2], f[b,2], f[c,2]}, this is equivalent to {Distributed[x, Emp[...]], Distributed[y, Emp[...]], Distributed[z, Emp[...]]} $\endgroup$ – Rojo Jan 15 '14 at 20:37
  • 1
    $\begingroup$ I get it now! This is saying that x, y, and z are each distributed like the EmpiricalDistribution. The Thread is over the two lines of code, not just over the third line. Thanks for clarifying! $\endgroup$ – bill s Jan 15 '14 at 21:45
  • $\begingroup$ @bills no problem :) $\endgroup$ – Rojo Jan 15 '14 at 21:46
  • $\begingroup$ @ bill s; Thanks for asking what I was thinking too. $\endgroup$ – bobbym Jan 16 '14 at 9:44

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.