Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

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

1 Answer 1

up vote 4 down vote accepted

This is a possibility

Probability[
    x + y + z > 14, 
   {x, y, z} \[Distributed] 
        EmpiricalDistribution[{1, 2, 3, 4, 5, 6}] // Thread
 ]
share|improve this answer
    
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. –  bill s Jan 15 at 20:22
    
@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[...]]} –  Rojo Jan 15 at 20:37
1  
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! –  bill s Jan 15 at 21:45
    
@bills no problem :) –  Rojo Jan 15 at 21:46
    
@ bill s; Thanks for asking what I was thinking too. –  bobbym Jan 16 at 9:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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