0

I'll prefix this with - I'm not particularly great at Maths, so I might ask for an explanation of some of the answers. What I'm trying to do is convert this into something I can code.

I've got a distribution of probabilities for dice rolls that I've managed to generate for a D6 (6 sided) dice. These distributions cover 1-5 dice (1D6-5D6) and look something like the following:

[100.0000,83.3333,66.6667,50.0000,33.3333,16.6667,0.0000,0.0000.....]
[100.0000,100.0000,97.2222,91.6667,83.3333,72.2222,58.3333,41.6667.....]

These are cumulative probabilities. E.g. The probability I roll a 1 or more with 1D6 = 100%, the probability of a 2 with 1D6 = 83.3%.

What I want to do is calculate the probability of rolling an exact range (e.g. 3-5). I thought I'd figured this out for 1D6 using the following example:

p(rangeLower - 1) - p(rangeUpper) = p(2) - p(5) = 83.33% - 33.33%;

As soon as I tried to apply this to the range 1-6 for 1D6 however it all fell flat on it's face not giving 100%. I can't seem to figure out how to achieve this so was hoping someone might be able to give me a pointer?

Ian
  • 103
  • You need to define $p(0)$ to be $0$, then the process should work. – André Nicolas May 24 '15 at 19:37
  • @AndréNicolas: But for 1-6: p(rangeLower - 1) - p(rangeUpper) = p(0) - p(6) = 0% - 16% = -16% – Ian May 24 '15 at 19:39
  • P(x=3,4,or 5 ) = P(3)-P(6) – WW1 May 24 '15 at 19:40
  • @AndréNicolas: PS - is there a link somewhere to show how to do formula notation on math.stackexchange? – Ian May 24 '15 at 19:40
  • @WW1: Hmm - that looks much more like what I was after! Means I need to extend my distributions to cover 1 more value than the total side of the dice can produce, but that's no problem. Could you add that as an answer? – Ian May 24 '15 at 19:45
  • I misread, the usual cumulative distribution function runs the other way, probability of $k$ or less. So I carelessly assumed that's what you were doing. Suppose $p(k)$ is the probability of $k$ or more, Then we want $p(k)-p(k+1)$ where for one die we define $p(7)$ to be $0$, for $2$ dice we define $p(13)$ to be $0$, and so on. – André Nicolas May 24 '15 at 19:46
  • @AndréNicolas: Yup - that looks better, same as WW1's comment. If one of you cares to answer I'll accept. Thanks for the prompt response - can get back to programming where I'm much more in my comfort zone! – Ian May 24 '15 at 19:48
  • I will hope WW1 does it. He read what you wrote correctly, while I thought your function was the standard cumulative distribution function. – André Nicolas May 24 '15 at 19:52
  • @AndréNicolas: OK - thanks though, I think so far your comments have provided a little more detail. I'll also try to emphasis the distribution in any further questions (I'd like to combine probabilities eg for D6/D8 distributions to calculate a sum later on) which I imagine is much more complicated! – Ian May 24 '15 at 19:54

1 Answers1

1

your vector has $P(n) = P(x \ge n)$

so $P(3) = P(x \in \{3,4,5,6\} ) $

So $P(x \in \{4,5\}) = P(4) - P(6)$

in General $P( a \le x \le b) = P(a)-P(b+1)$

so for an n sided dice you need to include $P(n+1)=0$ ( I see you have done that for your first vector )

WW1
  • 10,497