News:

Forum changes: Editing of posts has been turned off until further notice.

Main Menu

Help with dice statistics

Started by coxcomb, February 10, 2005, 10:41:00 PM

Previous topic - Next topic

Eero Tuovinen

OK, once more, slowly...

Above I derivated the expected value of the highest die in a n die pool. The probability function was P=[(m/6)^n][1-(1-1/m)^n]. This is how you calculate the expected value for n=3:

P(1)=(1/6^3)
P(2)=[(2/6)^3][1-(1/2)^3]
P(3)=[(3/6)^3][1-(2/3)^3]
P(4)=[(4/6)^3][1-(3/4)^3]
P(5)=[(5/6)^3][1-(4/5)^3]
P(6)=[(6/6)^3][1-(5/6)^3]

Now, the expected value is calculated by multiplying each probability with the value it's the probability for. That's what you do in the one die case as well: that calculation you did in the first post, remember? The divisor, 6, was there because each of those results has 1/6 probability in a die roll. You just did the summing first and divided after that to get the result. Here we do the divisions first, because the probabilities of the different results are different. So:

E=P(1)+2P(2)+3P(3)+4P(4)+5P(5)+6P(6), where E is the expected value. You can check the calculation against Walt's values. This is really simple to do with a spreadsheet.

Now, the second die:

A="At least one die is at k."
B="All dice are at most k, except the highest."
C="Highest die is at least k."
The die pool is still n dice. Question: What is P(A and B and C), which is the probability for the second-highest die to hit k? Event C is necessary because otherwise it wouldn't be the second-highest die.

All three probabilities are dependent on each other. The probability of C is simple, because we already calculated it: P(C)=[sum of P(k)...P(6) above]. Probability of B happening if C happens is simple, too, because it's the same as probability of event B in the last case, except with a pool one die smaller. Thus P(B|C)=(k/6)^(n-1). (The one die is already assumed to be higher than k and out of the calculation.)

Probability of A when B and C happen is again the same case as with the highest die, the pool is just a little smaller. Thus P(A|B and C)=1-(1-1/k)^(n-1)

By the multiplication rule I mentioned earlier we get P(A and B and C)=P(A and B|C)P(C)=P(A|BC)P(B|C)P(C). This is again a readily calculable probability function, which we can use to find the expected value, just like with the highest die.

The third die can be found in the same manner. As you can see above, the calculation itself is just a matter of picking the already calculated components from the earlier calculation. Perhaps shaheddy derivates that one for kicks ;)

And the grail we're after, the expected average value of the three highest dice, is just a matter of averaging between the three results once they're in. After that we have a general, albeit long, function for a pool with n dice.

But anyway, coxcomb: if you'll tell us more specifically at which point you're getting lost, we can perhaps explain it in more detail. It's difficult to explain these things when we don't know your background on math. Alternatively, we can just produce the results if you tell us how big die pools you're using... or you can write that program, it's not like it'd produce any worse results than the analytical approach!
Blogging at Game Design is about Structure.
Publishing Zombie Cinema and Solar System at Arkenstone Publishing.

Brendan

Quote from: Grand_Commander13Well, my Java program got those stats by brute-forcing them.  It was really annoying to write it.  You think it'd be so simple.  If only arrays could be dynamically sized...

That, my good man, is what PHP is for.  (Or vectors.)

I'm working on a generalized version of the scripts I posted earlier, which should let you have the per-die average for any number and sides of dice.