PDA

View Full Version : Finding out what numbers my dice are biased towards.



Mystic Muse
2012-07-09, 12:46 AM
I don't use Game Science dice because I like my dice to have neat colors on them and such. Recently, I developed an interest in determine what rolls my dice consistently get, and I was wondering how many rolls would be needed to determine this to a good degree.

huttj509
2012-07-09, 01:26 AM
I don't use Game Science dice because I like my dice to have neat colors on them and such. Recently, I developed an interest in determine what rolls my dice consistently get, and I was wondering how many rolls would be needed to determine this to a good degree.

Roll dice n times (where n is a multiple of 20). Note how many times you rolled each number.

Compute X^2 as follows: For each number, take how many times you rolled it, subtract n/20 (this is the expected number of times), square it, and divide by n/20. Add these up.

If X^2 > 30 you're 95% sure that your die is not fair.

X^2 (chi-squared) is a measure of how much a distribution varies from the expected distribution. It's the sum of ((observed-expected)^2)/expected. You then compare on a chart (http://www.medcalc.org/manual/chi-square-table.php) for the degrees of freedom involved (the d20 roll has 19 degrees of freedom). For 95% confidence, we want P = .05, so that's where the 30 comes from for the X^2 you're looking for.

For something non-critical like this 95% confidence should be fine. Depending on how skewed the die is, even 100 rolls might be plenty sufficient (for example, if you rolled 1-10 0 times, and 11-20 10 times each, X^2 = 100, which is well above the threshold).

Edit: If that's as obtuse as it seems to me rereading, I can post a few example distributions.

Mystic Muse
2012-07-18, 10:19 PM
Posting a few sample distributions would be nice. Sorry that it took me a while to get back to you.

huttj509
2012-07-19, 01:24 AM
Ok. Let's say with 100 rolls you get:


Roll Observed Expected
1 4 5
2 7 5
3 8 5
4 3 5
5 5 5
6 5 5
7 2 5
8 4 5
9 6 5
10 3 5
11 1 5
12 2 5
13 3 5
14 5 5
15 5 5
16 7 5
17 8 5
18 8 5
19 8 5
20 6 5

So for each number on the die, we compute (observed-expected), square it, divide by the expected, and add them up. I'm just listing the absolute value of O-E since the squaring would undo any negative numbers anyway.



Roll |O-E| (O-E)^2/E
1 1 0.2
2 2 0.8
3 3 1.8
4 2 0.8
5 0 0
6 0 0
7 3 1.8
8 1 0.2
9 1 0.2
10 2 0.8
11 4 3.2
12 3 1.8
13 2 0.8
14 0 0
15 0 0
16 2 0.8
17 3 1.8
18 3 1.8
19 3 1.8
20 1 0.2

Total: 18.8

Our total X^2 value is 18.8. Even though the distribution looks at a glance to be top-heavy, we'd end up with a result this skewed more than 1/5 of the time we rolled the die 100 times, if it were completely fair.

Now it might be if I kept rolling for another 100 times, for a total of 200 rolls, a bias might appear. In general, you want <5% chance that your distribution matches a fair die to reasonably claim it's skewed, so for a d20 you want to look for X^2 > 30 (from the linked table, 20 faces is 19 degrees of freedom, and we're looking for P of .05).

The above distribution was made up BTW. And honestly, when I was making it, I thought it would come out as skewed. Humans are poor at judging when a distribution really is reasonably random. We see patterns a lot.

Jay R
2012-07-19, 09:31 AM
The Chi-squared distribution will only give you a yes/no answer (to a given level of significance) on whether your dice are completely fair or not.

But you want more than that. You want to know which numbers are more likely, and by how much.

There's a very complicated formula for that. But there's a much simpler approximation.

Roll the die n times. Calculate the proportion of times you rolled a given result. For instance, if you rolled a d20 100 times, and got a 20 4 times, your proportion is 0.04, or 4%. But of course this is a random result, and if you did it again, you'd get a different random result.

So you want to estimate the "real" probability - the proportion of times you;d get if you rolled it forever.

There's a (very roughly) 95% chance that the true probability is the number you got +/- 1/sqrt(n). So you would estimate that the true probability of a 20 is 0.04 plus or minus 1/sqrt(100), or somewhere between -6% and 14%.

Clearly, this is not accurate enough to know whether its probability is greater than 5%.

You don't want to do square root calculations, so here's a useful table:

100 roles +/- 10%
400 rolls, +/- 5%
1,000 rolls, +/- 3%
2,500 rolls, +/- 2%
10,000 rolls, +/- 1%
40,000 rolls, +/- 0.5%

As you can see, it takes a lot of rolls to be fairly sure what the probabilities are. If you roll 55 20s out of 10,000 rolls, you can estimate the true probability of a 20 to be 5.5% +/- 1%, or somewhere between 4.5% and 5.5%. (Note that you still wouldn't know if the die is perfectly accurate or not.) Also, don't forget that this is only a 95% confidence interval. You'll be wrong 5% of the time. When you're testing every roll on a d20, that means one of your results is likely wrong.

This is a general result. For a specific case, you can do somewhat better. If you are asking about specific rolls on a d20, you can use this table:

20 rolls, +/- 10%
75 rolls, +/- 5%
200 rolls, +/- 3%
500 rolls, +/- 2%
2,000 rolls, +/- 1%
7,500 rolls, +/- 0.5%

Use this only for specific rolls on a d20 (the probability of rolling a 20, not the probability of rolling 15 or more). You can Use the first table for anything - it's a "worst-case" result.

Why is this table different? Because the square root of (0.05)(0.95) is significantly smaller than the square root of (0.5)(0.5). Don't ask.