Results 31 to 38 of 38
Thread: Statistics of dropping dice

20180713, 11:53 AM (ISO 8601)
 Join Date
 Jan 2009
Re: Statistics of dropping dice
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 about5 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.

20180713, 01:30 PM (ISO 8601)
 Join Date
 Dec 2006
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.Last edited by Errata; 20180713 at 01:32 PM.

20180719, 01:42 PM (ISO 8601)
 Join Date
 Jul 2016
Re: Statistics of dropping dice
In my experience, dropping dice results in lost dice.
Hope this helps!Last edited by Calthropstu; 20180719 at 01:43 PM.

20180721, 04:06 PM (ISO 8601)
 Join Date
 Sep 2016
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.
The odds of the m die being less than an X is x^m*(1x)^(nm)*(n!)/(m!)/(nm!)
[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*(1x)^(nm)*(n!)/(m!)/(nm!) * (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

20180722, 10:13 AM (ISO 8601)
 Join Date
 Feb 2015
Re: Statistics of dropping dice
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(1x)*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.

20180722, 02:32 PM (ISO 8601)
 Join Date
 Dec 2006
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 Y1, then every single dice has to be a Y1 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 Y1 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.Last edited by Errata; 20180722 at 02:35 PM.

20180722, 03:15 PM (ISO 8601)
 Join Date
 Sep 2016
Re: Statistics of dropping dice
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 01), Our case is when M1 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 (1X) of being more than X. Again There are NM 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^(m1)*(1x)^(nm)*(n!)/(m1!)/(nm!) * (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].Last edited by jayem; 20180722 at 03:25 PM.

20180723, 09:25 AM (ISO 8601)
 Join Date
 Feb 2015
Re: Statistics of dropping dice
Well, I went and looked up a few things. The term for values like the kth smallest of a set of independent identically distributed random variables is order statistic. The Wikipedia article on Order Statistics gives the distribution for the kth 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)(nm)/(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.