Help - Search - Members - Calendar
Full Version: Probability of scoring at least x successes
Dumpshock Forums > Discussion > Shadowrun
Orient
I worked out the probability of scoring at least x successes on n dice for a given test - were people looking for that a bit ago?


I don't know how to make equations look pretty in bbcode, here.. so it might be hard to read.

A few notes:
(1) n! = n*(n-1)*(n-2)*...*3*2*1
(2) Sum((i=1 to n), A_i) = A_1 + A_2 + A_3 + ... + A_n

Then the probability P(x) of rolling exactly x successes on n dice is:

P(x) = (1/3)^x * n! / (x! * (n-x)!)

And the probability of rolling at least x successes on n dice is:

Sum((i=x to n), P(i) )

Can anyone make that look a bit nicer? Or does that work...?

Feel free to double check my math, too. I'm certainly not immune to error..
Edit: Ignore these calculations. Not accurate. Damn.
Orient
Wait ... crap. That 2nd part doesn't look right.
Fortune
Try using

CODE

[code] tags
smile.gif
Orient
QUOTE (Fortune)
Try using

CODE

[code][ /CODE] tags
smile.gif

Well, if you can point me to a site that has a brief rundown of what al I can put in there.. wink.gif
Fortune
You asked for something to make your math look pretty. Ain't my job to be supplying the math. wink.gif
Orient
QUOTE (Fortune)
You asked for something to make your math look pretty. Ain't my job to be supplying the math. wink.gif

Bah. The math has been supplied.

cool.gif
Jaid
just on a side note, there are already some old threads with this information in them. i remember the threads existing, but my search-fu has failed me as far as finding them....

so if you can track down those threads, you can save yourself the bother of making anything look pretty =D
Kagetenshi
Well, the most obvious error is that you have a variable k as the lower index of summation which is never actually defined or provided.

(Yeah, it's trivial to figure out what it should be, but it's still wrong)

~J
Fortune
QUOTE (Jaid)
Just on a side note, there are already some old threads with this information in them. i remember the threads existing, but my search-fu has failed me as far as finding them....

so if you can track down those threads, you can save yourself the bother of making anything look pretty


But Orient was so proud of all his work. Why would you want to go and spoil it? nyahnyah.gif biggrin.gif
Orient
QUOTE (Fortune)
QUOTE (Jaid)
Just on a side note, there are already some old threads with this information in them. i remember the threads existing, but my search-fu has failed me as far as finding them....

so if you can track down those threads, you can save yourself the bother of making anything look pretty


But Orient was so proud of all his work. Why would you want to go and spoil it? nyahnyah.gif biggrin.gif

Hell, I'd have had to check their math, anyway.
Orient
QUOTE (Kagetenshi)
Well, the most obvious error is that you have a variable k as the lower index of summation which is never actually defined or provided.

(Yeah, it's trivial to figure out what it should be, but it's still wrong)

~J

Whoop. I was using k instead of x on scratch paper, and it slipped in..
Kagetenshi
k is a better choice (m might be even better), since x traditionally implies a real number where you want an integer or natural number.

Though I guess k is usually considered a real as well, and an unspecified constant at that. If you're in the mood for nitpicking, go with m.

~J
Orient
QUOTE (Kagetenshi @ Nov 3 2007, 09:29 PM)
k is a better choice (m might be even better), since x traditionally implies a real number where you want an integer or natural number.

Though I guess k is usually considered a real as well, and an unspecified constant at that. If you're in the mood for nitpicking, go with m.

~J

Naah - that's convention only - I just thought people would be more comfortable with x.

And if people are aware of those conventions, then they're probably savvy enough to realize that we're just using natural numbers, anyhow. And I wanted to reserve m for the possibility of writing a proof involving two separate sums, here.

;P

Hank
Oh, don't be so lazy. Add in probabilities if you throw in edge at first.

If you think it's complicated now, wait til the rule of six rears it's ugly head biggrin.gif
Orient
QUOTE (Hank)
Oh, don't be so lazy. Add in probabilities if you throw in edge at first.

If you think it's complicated now, wait til the rule of six rears it's ugly head biggrin.gif

Yeah, yeah .. you just multiply some stuff. Or something. wink.gif
Riley37
I worked it out by hand for DP 2 and DP 3, treating it as "need 3 on 1d3".
DP 2: 44% 0 hits, 44% 1 hit, 11% 2 hits (totals 99% due to rounding)
DP 3: 30% 0 hits, 44% 1 hit, 22% 2 hits, 4% 3 hits

So if you only need one hit - eg firing a gun or throwing a rock at a static person-size target - then you have better-than-coinflip odds even at low DP.

Adding chance of crit-glitch is more math that I'm up to off the cuff.
GryMor
Here are the probabilities for dice counts up to 20. I'll post the exploding results when I get rid of a minor accuracy bug.

CODE

Key:
Hits
P{Hits and not glitch}
P{Hits and glitch}
P{Hits or more and not glitch}
P{Hits or more and glitch}

Count: 1
 0: 50.0000 16.6667 83.3333 16.6667
 1: 33.3333  0.0000 33.3333  0.0000


Count: 2
 0: 41.6667  2.7778 97.2222  2.7778
 1: 44.4444  0.0000 55.5556  0.0000
 2: 11.1111  0.0000 11.1111  0.0000


Count: 3
 0: 25.0000  4.6296 92.5926  7.4074
 1: 41.6667  2.7778 67.5926  2.7778
 2: 22.2222  0.0000 25.9259  0.0000
 3:  3.7037  0.0000  3.7037  0.0000


Count: 4
 0: 18.7500  1.0031 98.3796  1.6204
 1: 38.8889  0.6173 79.6296  0.6173
 2: 29.6296  0.0000 40.7407  0.0000
 3:  9.8765  0.0000 11.1111  0.0000
 4:  1.2346  0.0000  1.2346  0.0000


Count: 5
 0: 11.8056  1.3632 96.4506  3.5494
 1: 31.2500  1.6718 84.6451  2.1862
 2: 32.4074  0.5144 53.3951  0.5144
 3: 16.4609  0.0000 20.9877  0.0000
 4:  4.1152  0.0000  4.5267  0.0000
 5:  0.4115  0.0000  0.4115  0.0000


Count: 6
 0:  8.4491  0.3301 99.1298  0.8702
 1: 25.9259  0.4115 90.6807  0.5401
 2: 32.7932  0.1286 64.7548  0.1286
 3: 21.9479  0.0000 31.9616  0.0000
 4:  8.2305  0.0000 10.0137  0.0000
 5:  1.6461  0.0000  1.7833  0.0000
 6:  0.1372  0.0000  0.1372  0.0000


Count: 7
 0:  5.4398  0.4130 98.2367  1.7633
 1: 19.7145  0.7702 92.7969  1.3503
 2: 30.2469  0.4801 73.0824  0.5801
 3: 25.5058  0.1000 42.8355  0.1000
 4: 12.8029  0.0000 17.3297  0.0000
 5:  3.8409  0.0000  4.5267  0.0000
 6:  0.6401  0.0000  0.6859  0.0000
 7:  0.0457  0.0000  0.0457  0.0000


Count: 8
 0:  3.7953  0.1065 99.5391  0.4609
 1: 15.4064  0.2010 95.7438  0.3544
 2: 27.1862  0.1267 80.3374  0.1534
 3: 27.2862  0.0267 53.1512  0.0267
 4: 17.0706  0.0000 25.8650  0.0000
 5:  6.8282  0.0000  8.7944  0.0000
 6:  1.7071  0.0000  1.9662  0.0000
 7:  0.2439  0.0000  0.2591  0.0000
 8:  0.0152  0.0000  0.0152  0.0000

Count: 9
 0:  2.4740  0.1273 99.1050  0.8950
 1: 11.3860  0.3195 96.6310  0.7677
 2: 23.1096  0.3015 85.2450  0.4482
 3: 27.1862  0.1267 62.1355  0.1467
 4: 20.4647  0.0200 34.9493  0.0200
 5: 10.2423  0.0000 14.4846  0.0000
 6:  3.4141  0.0000  4.2422  0.0000
 7:  0.7316  0.0000  0.8281  0.0000
 8:  0.0914  0.0000  0.0965  0.0000
 9:  0.0051  0.0000  0.0051  0.0000


Count: 10
 0:  1.6999  0.0342 99.7562  0.2438
 1:  8.5841  0.0867 98.0562  0.2096
 2: 19.4268  0.0825 89.4721  0.1229
 3: 25.9774  0.0349 70.0454  0.0405
 4: 22.7552  0.0056 44.0680  0.0056
 5: 13.6565  0.0000 21.3128  0.0000
 6:  5.6902  0.0000  7.6564  0.0000
 7:  1.6258  0.0000  1.9662  0.0000
 8:  0.3048  0.0000  0.3404  0.0000
 9:  0.0339  0.0000  0.0356  0.0000
10:  0.0017  0.0000  0.0017  0.0000


Count: 11
 0:  1.1164  0.0397 99.5391  0.4609
 1:  6.2331  0.1254 98.4227  0.4212
 2: 15.7375  0.1589 92.1896  0.2958
 3: 23.7438  0.1008 76.4521  0.1369
 4: 23.8126  0.0320 52.7082  0.0361
 5: 16.6871  0.0041 28.8957  0.0041
 6:  8.3456  0.0000 12.2085  0.0000
 7:  2.9806  0.0000  3.8629  0.0000
 8:  0.7451  0.0000  0.8823  0.0000
 9:  0.1242  0.0000  0.1372  0.0000
10:  0.0124  0.0000  0.0130  0.0000
11:  0.0006  0.0000  0.0006  0.0000


Count: 12
 0:  0.7597  0.0110 99.8707  0.1293
 1:  4.5894  0.0350 99.1110  0.1183
 2: 12.6725  0.0446 94.5216  0.0833
 3: 21.1667  0.0285 81.8490  0.0387
 4: 23.8355  0.0091 60.6823  0.0103
 5: 19.0745  0.0012 36.8468  0.0012
 6: 11.1275  0.0000 17.7722  0.0000
 7:  4.7689  0.0000  6.6448  0.0000
 8:  1.4903  0.0000  1.8758  0.0000
 9:  0.3312  0.0000  0.3856  0.0000
10:  0.0497  0.0000  0.0544  0.0000
11:  0.0045  0.0000  0.0047  0.0000
12:  0.0002  0.0000  0.0002  0.0000


Count: 13
 0:  0.5013  0.0125 99.7602  0.2398
 1:  3.2922  0.0476 99.2589  0.2273
 2:  9.9438  0.0758 95.9666  0.1797
 3: 18.3048  0.0644 86.0228  0.1040
 4: 22.9306  0.0308 67.7180  0.0396
 5: 20.6574  0.0079 44.7874  0.0087
 6: 13.7760  0.0008 24.1300  0.0008
 7:  6.8884  0.0000 10.3539  0.0000
 8:  2.5832  0.0000  3.4655  0.0000
 9:  0.7175  0.0000  0.8823  0.0000
10:  0.1435  0.0000  0.1648  0.0000
11:  0.0196  0.0000  0.0213  0.0000
12:  0.0016  0.0000  0.0017  0.0000
13:  0.0001  0.0000  0.0001  0.0000


Count: 14
 0:  0.3390  0.0035 99.9313  0.0687
 1:  2.3843  0.0135 99.5923  0.0652
 2:  7.7713  0.0217 97.2080  0.0516
 3: 15.5674  0.0185 89.4367  0.0300
 4: 21.4218  0.0089 73.8692  0.0114
 5: 21.4284  0.0023 52.4474  0.0025
 6: 16.0728  0.0002 31.0190  0.0002
 7:  9.1846  0.0000 14.9462  0.0000
 8:  4.0183  0.0000  5.7616  0.0000
 9:  1.3394  0.0000  1.7434  0.0000
10:  0.3349  0.0000  0.4040  0.0000
11:  0.0609  0.0000  0.0691  0.0000
12:  0.0076  0.0000  0.0082  0.0000
13:  0.0006  0.0000  0.0006  0.0000
14:  0.0000  0.0000  0.0000  0.0000


Count: 15
 0:  0.2244  0.0040 99.8743  0.1257
 1:  1.6951  0.0177 99.6498  0.1218
 2:  5.9607  0.0339 97.9548  0.1041
 3: 12.9522  0.0361 91.9940  0.0703
 4: 19.4593  0.0232 79.0418  0.0341
 5: 21.4218  0.0089 59.5825  0.0110
 6: 17.8570  0.0019 38.1607  0.0021
 7: 11.4806  0.0002 20.3037  0.0002
 8:  5.7404  0.0000  8.8232  0.0000
 9:  2.2324  0.0000  3.0828  0.0000
10:  0.6697  0.0000  0.8504  0.0000
11:  0.1522  0.0000  0.1807  0.0000
12:  0.0254  0.0000  0.0285  0.0000
13:  0.0029  0.0000  0.0031  0.0000
14:  0.0002  0.0000  0.0002  0.0000
15:  0.0000  0.0000  0.0000  0.0000


Count: 16
 0:  0.1511  0.0011 99.9634  0.0366
 1:  1.2128  0.0051 99.8123  0.0355
 2:  4.5575  0.0098 98.5994  0.0304
 3: 10.6465  0.0105 94.0419  0.0206
 4: 17.3110  0.0068 83.3954  0.0100
 5: 20.7787  0.0026 66.0844  0.0032
 6: 19.0490  0.0006 45.3058  0.0006
 7: 13.6067  0.0001 26.2568  0.0001
 8:  7.6538  0.0000 12.6501  0.0000
 9:  3.4017  0.0000  4.9962  0.0000
10:  1.1906  0.0000  1.5945  0.0000
11:  0.3247  0.0000  0.4040  0.0000
12:  0.0676  0.0000  0.0792  0.0000
13:  0.0104  0.0000  0.0116  0.0000
14:  0.0011  0.0000  0.0012  0.0000
15:  0.0001  0.0000  0.0001  0.0000
16:  0.0000  0.0000  0.0000  0.0000


Count: 17
 0:  0.1002  0.0013 99.9337  0.0663
 1:  0.8563  0.0064 99.8334  0.0651
 2:  3.4364  0.0145 98.9771  0.0586
 3:  8.6086  0.0186 95.5408  0.0442
 4: 15.0826  0.0149 86.9322  0.0256
 5: 19.6191  0.0077 71.8496  0.0107
 6: 19.6243  0.0025 52.2305  0.0030
 7: 15.4206  0.0005 32.6062  0.0005
 8:  9.6381  0.0000 17.1856  0.0000
 9:  4.8191  0.0000  7.5475  0.0000
10:  1.9276  0.0000  2.7284  0.0000
11:  0.6133  0.0000  0.8008  0.0000
12:  0.1533  0.0000  0.1875  0.0000
13:  0.0295  0.0000  0.0341  0.0000
14:  0.0042  0.0000  0.0047  0.0000
15:  0.0004  0.0000  0.0004  0.0000
16:  0.0000  0.0000  0.0000  0.0000
17:  0.0000  0.0000  0.0000  0.0000


Count: 18
 0:  0.0673  0.0004 99.9804  0.0196
 1:  0.6071  0.0019 99.9131  0.0192
 2:  2.5839  0.0043 99.3060  0.0173
 3:  6.8962  0.0055 96.7221  0.0131
 4: 12.9363  0.0044 89.8259  0.0076
 5: 18.1147  0.0023 76.8896  0.0032
 6: 19.6260  0.0007 58.7749  0.0009
 7: 16.8228  0.0001 39.1488  0.0001
 8: 11.5658  0.0000 22.3260  0.0000
 9:  6.4254  0.0000 10.7602  0.0000
10:  2.8914  0.0000  4.3348  0.0000
11:  1.0514  0.0000  1.4434  0.0000
12:  0.3067  0.0000  0.3919  0.0000
13:  0.0708  0.0000  0.0853  0.0000
14:  0.0126  0.0000  0.0145  0.0000
15:  0.0017  0.0000  0.0019  0.0000
16:  0.0002  0.0000  0.0002  0.0000
17:  0.0000  0.0000  0.0000  0.0000
18:  0.0000  0.0000  0.0000  0.0000


Count: 19
 0:  0.0447  0.0004 99.9648  0.0352
 1:  0.4262  0.0023 99.9201  0.0348
 2:  1.9224  0.0060 99.4939  0.0325
 3:  5.4549  0.0090 97.5715  0.0265
 4: 10.9190  0.0087 92.1166  0.0175
 5: 16.3860  0.0056 81.1975  0.0088
 6: 19.1211  0.0024 64.8116  0.0032
 7: 17.7569  0.0007 45.6904  0.0008
 8: 13.3181  0.0001 27.9336  0.0001
 9:  8.1389  0.0000 14.6155  0.0000
10:  4.0694  0.0000  6.4766  0.0000
11:  1.6648  0.0000  2.4072  0.0000
12:  0.5549  0.0000  0.7424  0.0000
13:  0.1494  0.0000  0.1875  0.0000
14:  0.0320  0.0000  0.0381  0.0000
15:  0.0053  0.0000  0.0061  0.0000
16:  0.0007  0.0000  0.0007  0.0000
17:  0.0001  0.0000  0.0001  0.0000
18:  0.0000  0.0000  0.0000  0.0000
19:  0.0000  0.0000  0.0000  0.0000


Count: 20
 0:  0.0300  0.0001 99.9895  0.0105
 1:  0.3000  0.0007 99.9595  0.0104
 2:  1.4267  0.0018 99.6595  0.0097
 3:  4.2827  0.0027 98.2328  0.0079
 4:  9.1038  0.0026 93.9501  0.0052
 5: 14.5686  0.0017 84.8463  0.0026
 6: 18.2122  0.0007 70.2776  0.0010
 7: 18.2127  0.0002 52.0655  0.0002
 8: 14.7979  0.0000 33.8528  0.0000
 9:  9.8653  0.0000 19.0549  0.0000
10:  5.4259  0.0000  9.1896  0.0000
11:  2.4663  0.0000  3.7637  0.0000
12:  0.9249  0.0000  1.2973  0.0000
13:  0.2846  0.0000  0.3725  0.0000
14:  0.0711  0.0000  0.0879  0.0000
15:  0.0142  0.0000  0.0167  0.0000
16:  0.0022  0.0000  0.0025  0.0000
17:  0.0003  0.0000  0.0003  0.0000
18:  0.0000  0.0000  0.0000  0.0000
19:  0.0000  0.0000  0.0000  0.0000
20:  0.0000  0.0000  0.0000  0.0000
Orient
QUOTE (GryMor)
Here are the probabilities for dice counts up to 20. I'll post the exploding results when I get rid of a minor accuracy bug.

What was the expression used to evaluate those? Mine's all kinds of screwed up.
GryMor
I used a simple recursive calculation.

Basically, if you have know the roll probabilities for 1 die:

CODE

rollP(1) = (H0B1E0 => 1/6, H1B0E0 => 1/6, H1B0E1 => 1/6, H0B0E0 => 1/2)


and you have a rule for generating the nth table from the nth -1 table

CODE

for aRoll in rollP(1)
for bRoll in rollP(n-1)
 cRoll.[H,B,E] = aRoll.[H,B,E] + bRoll.[H,B,E]
 rollP(n)[cRoll] += rollP(1)[aRoll] * rollP(n-1)[bRoll]


Then it's a simple matter of collapsing the total roll probability table for a particular number of dice n down to a (2, n) table of the probabilities of the states we care about, that is (glitch|!glitch, hits)

I'm honestly not sure how you would express this in terms of a clean formula, the glitch probabilities make things messy, the exploding counts just makes things explode.

Oh, and please pardon my pseudo code. The actually code is in perl, but needs cleaning up a bit.
Orient
QUOTE (GryMor)
I used a simple recursive calculation.

Basically, if you have know the roll probabilities for 1 die:

CODE

rollP(1) = (H0B1E0 => 1/6, H1B0E0 => 1/6, H1B0E1 => 1/6, H0B0E0 => 1/2)


and you have a rule for generating the nth table from the nth -1 table

CODE

for aRoll in rollP(1)
for bRoll in rollP(n-1)
 cRoll.[H,B,E] = aRoll.[H,B,E] + bRoll.[H,B,E]
 rollP(n)[cRoll] += rollP(1)[aRoll] * rollP(n-1)[bRoll]


Then it's a simple matter of collapsing the total roll probability table for a particular number of dice n down to a (2, n) table of the probabilities of the states we care about, that is (glitch|!glitch, hits)

I'm honestly not sure how you would express this in terms of a clean formula, the glitch probabilities make things messy, the exploding counts just makes things explode.

Oh, and please pardon my pseudo code. The actually code is in perl, but needs cleaning up a bit.

I'm not really up on any coding languages, but I should be able to puzzle it out.

And, yeah - probably would have been smarter for me to use a recursion formula.

..thanks. biggrin.gif
Demerzel
I put together some nice tables in PDF format regarding these types of probabilities. However since I've moved from cable to DSL I lost my webspace (Curse you DSL). So until I get myself an alternative I don't have them hosted. But if you'd like them PM me your email and I'll send them to you.

Edit: Here's my original thread. The links are broken until I can get these rehosted somewhere. In the mean time, like I said, PM me and I can EMail them to you.

http://forums.dumpshock.com/index.php?showtopic=16917
GryMor
Actually, lets first throw out the E portion and then do a by hand demo of 2 dice:

CODE

rollP(1) = {H0B1 => 1/6, H1B1 => 1/3, H0B0 => 1/2}
unrolling the loops:
rollP(2)[H0B2] += rollP(1)[H0B1] * rollP(1)[H0B1]
rollP(2)[H1B1] += rollP(1)[H0B1] * rollP(1)[H1B0]
rollP(2)[H0B1] += rollP(1)[H0B1] * rollP(1)[H0B0]

rollP(2)[H1B1] += rollP(1)[H1B0] * rollP(1)[H0B1]
rollP(2)[H2B0] += rollP(1)[H1B0] * rollP(1)[H1B0]
rollP(2)[H1B0] += rollP(1)[H1B0] * rollP(1)[H0B0]

rollP(2)[H0B1] += rollP(1)[H0B0] * rollP(1)[H0B1]
rollP(2)[H1B0] += rollP(1)[H0B0] * rollP(1)[H1B0]
rollP(2)[H0B0] += rollP(1)[H0B0] * rollP(1)[H0B0]

For display we collapse it like so:

0: rollP(2)[H0B0] + rollP(2)[H0B1], roll(2)[H0B2]
1: rollP(2)[H1B0] + rollP(2)[H1B1], roll(2)[H1B2]
2: rollP(2)[H2B0] + rollP(2)[H2B1], roll(2)[H2B2]

noting that 'impossible' rolls, since they aren't in the table, have a P of 0 (that is roll(2)[H2B2] doesn't show up so is presumed to be 0, which it is, you can get 2 hits and 2 1s on 2, non exploding, dice).


In other words, I'm brute forcing it, but just being careful to collapse things at the right time. Doesn't scale too well, but, good enough for the range of dice we care about.
Vaevictis
http://en.wikipedia.org/wiki/Binomial_distribution

For at least n successes, evaluate the cdf at n-1, and subtract from 1, yes?

For exactly n successes, evaluate the pdf.
Cheops
QUOTE (Vaevictis)
http://en.wikipedia.org/wiki/Binomial_distribution

For at least n successes, evaluate the cdf at n-1, and subtract from 1, yes?

For exactly n successes, evaluate the pdf.

That's the easy way to do it but only for hits/not hits. Gets more complicated if you are also trying to evaluate chances of glitches, critical glitches and exploding dice. Basically to use binomial distribution you have to work out odds for 2 mutually exclusive and exhaustive events.
GryMor
http://mathworld.wolfram.com/MultinomialDi...stribution.html gets you past the glitch hurdle, but, computationally, to generate the entire table, it's as expensive as the brute force calculation (since you do in fact need the entire probability map to answer the glitch question), and isn't of much help when it comes to exploding dice.

Actually, I've just realized I may have a bug in my glitch calculations when dealing with exploding dice. Given 3 dice, exploding, would any of these results be considered a glitch:
1, 1, 6:6:4 (2 hits, 2 original 1s, 3 original dice, 5 total dice)
1, 6:1, 6:1 (2 hits, 1 original 1, 3 total 1s, 3 original dice, 5 total dice)
1, 6:4, 6:1 (2 hits, 1 original 1, 2 total 1s, 3 original dice, 5 total dice)
Orient
Oh, yeah. The (1-1/3)^i part being the assurance that none of the other n-i dice are successes. For some reason I was specifically ignoring binomial expansion when I first posted. No idea what my justification was, at the time...

Exploding dice should be able to be incorporated by sticking a geometric sum in the summand somewhere.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Dumpshock Forums © 2001-2012