# Thread: Statistics of dropping dice

1. ## Re: Statistics of dropping dice

Originally Posted by Sivarias
I was actually referring to jeenlean's idea because that seems to be the way to calculate it manually. You create an array with every possible combination and go through checking for the highest values.
Yeah, that's what my idea does (or should do.)

It made the array as big as you needed, so if you have 10d6, it'd be ten columns (one for each die) and as many rows as you needed to do every possible combination.
In my idea, I tested the code using 100d100, and it took a noticeable time to run*, but it still ran fine. This was using R on an about-5 or 6 year old computer (though the computer was decent when new. Not top of the line, but pretty good).
*I forget the details, but about a minute to a few minutes. It wasn't something like a "leave it running for 20 minutes" job.

For this purpose (getting a distribution of dropping lowest die, as opposed to mine of getting a mean), you'd need to add another loop to take out the lowest value and then store the sums somewhere else to get your distribution, but I reckon that wouldn't be computationally expensive.

2. ## Re: Statistics of dropping dice

I guess it depends on your environment what implementation makes sense, but in general there is no reason to keep that much data around at once in a big table like that.

For the brute force method, you only need a single 1 dimensional array with a number of elements equal to the maximum possible roll (obtained by adding up the sides of all the dice if you rolled the highest value on each). Initialize the array to 0 in every element. Go through every possible permutation of dice rolls, and for each permutation, calculate what the sum of the roll would be after applying rules like drop N, then increment the array element for that value by 1. In the end you have an array that tells you the relative frequency for every possible roll. To convert them into a fraction, you just divide the integer in each element by the total number of permutations you went through.

As for how you go through every possible permutation, I discussed one easy way to implement that that requires two small arrays equal to the number of dice rolled.

3. ## Re: Statistics of dropping dice

In my experience, dropping dice results in lost dice.

Hope this helps!

4. ## Re: Statistics of dropping dice

See above for how to do with normal amounts of die.

Spoiler: late response to Errata

I can't really remember. I think I'd been planning to build up from even powers of the total Die count in which case you needed the lower drops kept (but you could in theory discard the lower die counts once used).

Spoiler: continuing the RPG of the gods

Taking the initial algorithm Errata gave.
For 20d6 drop 8:

Odds of the lowest roll being 6 is (1/6)^20.
Odds of the lowest roll being 5 is (2/6)^20 - (1/6)^20.
Odds of the lowest roll being 4 is (3/6)^20 - (2/6)^20 etc.

So take each case and stipulate temporarily that that is the lowest roll. Then multiply whatever result you get with that assumption by the odds of that being true.

If you assume the lowest roll is 4, you know you can't roll lower than 4, so they're not really d6 anymore. You rolled at least one 4. So in this case, it's the odds of the lowest being 4 odds of the result being the same as 19d3 drop 7 + 12*3
The degenerate case of the lowest being 6 is just 12*6.
Using N continuous (0-1) dice temporarily, so there is a M'th least die'. We can skip straight to that.
The odds of the m die being less than an X is x^m*(1-x)^(n-m)*(n!)/(m!)/(n-m!)
[note that n&m are constant for any one 'game']

If the die are all greater than X, then we can consider the situation where they can roll between X&1 which is easy to calculate the average = (x+1)/2

The average overall is thus just the integral of
x^m*(1-x)^(n-m)*(n!)/(m!)/(n-m!) * (x+1)/2

Which has to be pretty near doable, though you may need to break it into sections and approximate each.
For discrete die you'd be able to sum exactly, but then you'd need to deal with die on the 'border'

I'll have to put some more thought in it

5. ## Re: Statistics of dropping dice

Originally Posted by jayem
See above for how to do with normal amounts of die.

Spoiler: continuing the RPG of the gods

Taking the initial algorithm Errata gave.

Using N continuous (0-1) dice temporarily, so there is a M'th least die'. We can skip straight to that.
The odds of the m die being less than an X is x^m*(1-x)^(n-m)*(n!)/(m!)/(n-m!)
[note that n&m are constant for any one 'game']

If the die are all greater than X, then we can consider the situation where they can roll between X&1 which is easy to calculate the average = (x+1)/2

The average overall is thus just the integral of
x^m*(1-x)^(n-m)*(n!)/(m!)/(n-m!) * (x+1)/2

Which has to be pretty near doable, though you may need to break it into sections and approximate each.
For discrete die you'd be able to sum exactly, but then you'd need to deal with die on the 'border'

I'll have to put some more thought in it
I don't think those spoilerified formulas can be correct. If I plug in n=2, m=1, the integral you assert becomes the integral (from 0 to 1) of x(1-x)*2 * (x+1)/2. This is the integral of x - x^3, which is 1/4.

I'm pretty sure that taking two independent uniform random variables over [0,1], and dropping the smaller, leaves you with a value that has expectation greater than 1/2, and I think the expectation should be 2/3.

I can't think of a general formula that doesn't have summations in it.

6. ## Re: Statistics of dropping dice

My formula was a lot simpler, and I'm pretty sure it's valid.

If you roll XdY dice, and the lowest value is Y, then every single one of those dice has to be a Y, so the odds are (1/Y)^X. Very simple.
For the lowest value to be Y-1, then every single dice has to be a Y-1 or a Y, so the odds are (2/Y)^X, minus the odds of the lowest being Y, which is a subset of the possible conditions in which they are all Y-1 or Y. So it's (2/Y)^X - (1/Y)^X, and so on.

I don't think you need to worry about factorials for this specific situation.

ETA: I see, you're trying not to calculate the odds of the lowest dice, but the Nth lowest dice. I don't follow the math on how to do that.

7. ## Re: Statistics of dropping dice

Originally Posted by Errata
My formula was a lot simpler, and I'm pretty sure it's valid.

If you roll XdY dice, and the lowest value is Y, then every single one of those dice has to be a Y, so the odds are (1/Y)^X. Very simple.
For the lowest value to be Y-1, then every single dice has to be a Y-1 or a Y, so the odds are (2/Y)^X, minus the odds of the lowest being Y, which is a subset of the possible conditions in which they are all Y-1 or Y. So it's (2/Y)^X - (1/Y)^X, and so on.

I don't think you need to worry about factorials for this specific situation.

ETA: I see, you're trying not to calculate the odds of the lowest dice, but the Mth lowest dice. I don't follow the math on how to do that.
It's not so bad, based on your work (and I think I see where I went firstly wrong)
Each die has a probability X of being less than X (the die goes from 0-1), Our case is when M-1 die are less than X, so multiply them together. NB the Mth die is of course exactly X (which is where the dX comes from), this is my error.
Each die has a probability (1-X) of being more than X. Again There are N-M die in the situation.
We can then rearrange all the dice, in both groups, as in every other binomial case (hence the factorials), except when corrected it's actually a trinomial distribution with a single element in the middle block [for the discrete die case the middle block can also vary in the same 'game', so you need the double sum you had].

x^(m-1)*(1-x)^(n-m)*(n!)/(m-1!)/(n-m!) * (x+1)/2
Which seems much closer to the predicted 2/3rds for the 2dice drop 1 situation and giving about 3/4 for 3dice drop 2 [ETA which seems believable with Monte Carlo].

8. ## Re: Statistics of dropping dice

Well, I went and looked up a few things. The term for values like the k-th smallest of a set of independent identically distributed random variables is order statistic. The Wikipedia article on Order Statistics gives the distribution for the k-th smallest of n random variables uniform over the unit interval [0,1] as Beta(k,n+1,k), and says that is has mean k/(n+1). Not too surprising. Then the expected value of taking n random uniform [0,1] variables, dropping the m smallest, and summing the rest, is the sum{k=m+1 to n} of k/(n+1), which I calculate to be (n+m+1)(n-m)/(2(n+1)).

(Even though the order statistics are not independent from one another, I can still calculate the mean of a sum as the sum of means. Means are nice that way.)

At least, this evaluates to 2/3 when n=2 and m=1, so it passes one sanity check.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•