Tuesday, February 10, 2009

Dice Distributions

I got a bit obsessed with finding complete pictures for a sequence of sum-of-dice distributions. I finally completed a nice spreadsheet with charts of the distributions of everything from 1d6 to 10d6, here:

http://www.superdan.net/download/DiceSamples.xls

It provides a nice picture of the evolution of the distribution, as more dice are added, into one that (a) more closely matches a normal curve, as per the Central Limit Theorem, and also (b) gets narrower and narrower, as the standard deviation of the dice average falls. I printed out the first page (n=1 to 3) for my statistics class, in an attempt to intuitively anticipate the CLT.

The other nice thing here is that all the numbers come out of a programmed macro function for summed dice frequency (which I picked up from the Wikipedia article on Dice, and I wanted to see implemented in code): F(s,i,k) = sum n=0 to floor((k-i)/s): (-1)^n * choose(i, n) * choose(k-s*n-1, i-1).

http://en.wikipedia.org/wiki/Dice#Probability

4 comments:

  1. A few years back when I started playing Settlers of Cataan (a game where 2 dice are rolled), I took a closer look at the distribution of 2d6 (pretty important for that game). My intuition was that it would be a normal curve, and I was somewhat shocked to see that it is in fact stair-stepped. It's nice, though, to see that normal curve develop with more dice.

    p.s. This math installment doesn't seem all that angry... I think ANGRYMATH is mellowing... ;-)

    ReplyDelete
  2. My intuition was that it would be a normal curve, and I was somewhat shocked to see that it is in fact stair-stepped.

    Yes, technically that gets referred to as a "triangular distribution" (if you connect the top-middle of each bar you get a perfectly straight line on either side). You get that whenever you take a sum of 2 uniform distributions.

    Oh, and: Go to hell!!

    ReplyDelete
  3. I took a look into this a while back and while it is not a excel spreadsheet with formulae, you can fiddle with some of the parameters real-time to see changes to the curve.

    http://www.avanderw.co.za/dice-distributions/

    ReplyDelete
    Replies
    1. Very nice! Keep in mind that 2d6 isn't really a normal distribution, it's more like a (discrete) triangular distribution. Of course, as you increase the dice (sample size), it gets closer and closer to really normal (by the CLT). A very nice and polished app, thank you!

      Delete