Jump to content

  • Log In with Google      Sign In   
  • Create Account


Standard deviation of rolling dice


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 kSquared   Members   -  Reputation: 1356

Like
0Likes
Like

Posted 02 July 2006 - 05:46 PM

I have n k-sided dice that I would like to roll. Rather than rolling the n dice (which would take O(n)), I'm going to assume that the distribution is approximately normal (it is) and randomly select a integer z between 0 and 1000, where z/10 is the percentile; this will determine what the simulated value is (and it will be O(1)). In turn, this requires that I know the mean and standard deviation. The mean is easy; it is n(k + 1) / 2. The standard deviation, however, appears to be a bit harder. Using the multinomial distribution appears to be a good start, but I've forgotten how to transform the standard deviation of a specific random variable into a single quantitative value for the whole data. May I simply multiply the standard deviation for each value by the quantitative value itself? thanks,
- k2
"Choose a job you love, and you'll never have to work a day in your life." — Confucius"Logic will get you from A to B. Imagination will get you everywhere." — Albert Einstein"Money is the most egalitarian force in society. It confers power on whoever holds it." — Roger Starr{General Programming Forum FAQ} | {Blog/Journal} | {e-mail me} | {excellent webhosting}

Sponsor:

#2 Motorherp   Members   -  Reputation: 599

Like
0Likes
Like

Posted 03 July 2006 - 12:30 AM

Have a look here under # 1.2 Estimating standard deviation from a sample. Hope thats what you're looking for.

#3 kSquared   Members   -  Reputation: 1356

Like
0Likes
Like

Posted 03 July 2006 - 01:37 AM

Quote:
Original post by Motorherp
Have a look here under # 1.2 Estimating standard deviation from a sample. Hope thats what you're looking for.

Not exactly. I don't want the standard deviation of the sample (which is unlikely to be a perfect distribution); I want the standard deviation of the distribution itself. It needs to be O(1), so I don't want to calculate anything that has to do with obtaining n samples.
- k2
"Choose a job you love, and you'll never have to work a day in your life." — Confucius"Logic will get you from A to B. Imagination will get you everywhere." — Albert Einstein"Money is the most egalitarian force in society. It confers power on whoever holds it." — Roger Starr{General Programming Forum FAQ} | {Blog/Journal} | {e-mail me} | {excellent webhosting}

#4 Álvaro   Crossbones+   -  Reputation: 10630

Like
0Likes
Like

Posted 03 July 2006 - 03:38 AM

You can compute the variance of the distribution of rolling a single die. The result is (k^2-1)/12. I think the variances should add up, so the variance of the sum of n k-sided dice should be n*(k^2-1)/12. The standard deviation is the square root of that.



#5 kSquared   Members   -  Reputation: 1356

Like
0Likes
Like

Posted 03 July 2006 - 05:47 AM

Quote:
Original post by alvaro
You can compute the variance of the distribution of rolling a single die. The result is (k^2-1)/12. I think the variances should add up, so the variance of the sum of n k-sided dice should be n*(k^2-1)/12. The standard deviation is the square root of that.

That worked perfectly, thank you. Deviations from the predicted values are less than one part per million in 10,000 trials. ++rate!
- k2
"Choose a job you love, and you'll never have to work a day in your life." — Confucius"Logic will get you from A to B. Imagination will get you everywhere." — Albert Einstein"Money is the most egalitarian force in society. It confers power on whoever holds it." — Roger Starr{General Programming Forum FAQ} | {Blog/Journal} | {e-mail me} | {excellent webhosting}

#6 Raghar   Members   -  Reputation: 92

Like
0Likes
Like

Posted 03 July 2006 - 07:29 AM

Considering the mersene twister is so fast, and you can easily transparently perform the trick with sliding view, this is rather bad idea, if you are not rolling 1000, or rather 10000 dices.
Also note if you will roll these dices, you could get precise result. Rolling one 1000 side dice in a range 0-999 would give you malformed result.

Conclusion, you are effectively shooting yourself in the feet, and if the engine is sensitive you might get pretty bad results. Note you'd lose also advantages of a pure integer engine.

#7 kSquared   Members   -  Reputation: 1356

Like
0Likes
Like

Posted 03 July 2006 - 07:41 AM

Quote:
Original post by Raghar
Conclusion, you are effectively shooting yourself in the feet, and if the engine is sensitive you might get pretty bad results. Note you'd lose also advantages of a pure integer engine.

I'm not actually rolling dice per se, but the concept is similar. However, I feel confident that a suitable approximation like the one I've devised is the right way to go. n is going to be very large, on the order of 260 million or so; k is guaranteed to be less than 72.

Given these parameters, I think I'm safe; certainly, it's a far cry from "shooting myself in the foot", especially since it's a closed-form calculation. :)
- k2
"Choose a job you love, and you'll never have to work a day in your life." — Confucius"Logic will get you from A to B. Imagination will get you everywhere." — Albert Einstein"Money is the most egalitarian force in society. It confers power on whoever holds it." — Roger Starr{General Programming Forum FAQ} | {Blog/Journal} | {e-mail me} | {excellent webhosting}




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS