| Last Hussar | 01 Mar 2009 1:35 p.m. PST |
I'm a lot better than your average Joe with probabilities, but I can't work out a formula for this. I am Rolling D number of dice. The chance of one success (hit) is C. I heed to get H number of hits to win. eg Hit is 5 or 6 =1/3. I need to get 2 hits from 4 dice. What's the formula to calculate the over all chance. I can do it if the hits required are 1 or d-1, but not for numbers inbetween (Though 50/50 I can imagine a binary table in my head if the number of misses permitted is low enough, but I want a maths formula) |
| fred12df | 01 Mar 2009 2:35 p.m. PST |
Working out the inverse is often easier. i.e. in your example 2, 3, or 4 hits from 4 would be OK. So the only failures are1 or less hits. 4 misses is 2/3 ^ 4, and 1 hit is 1/3 x 2/3 ^3. 0.197 + 0.098 = 0.2957 chance of failure So chance of success is 0.7043 |
| I Jim I | 01 Mar 2009 3:14 p.m. PST |
Fred is close. He missed the fact that the 1 hit can be any of the 4 dice not just the first. so the chance of failure, F, where D – H = 2 is F = (1-C)^D + (D choose 1) * C * (1-C)^(D-1) (D choose 1) is a combination. (see link ) (n choose r) is usually written C(n,r) but since you are using C, I didn't want to confuse things. Anyway, (n choose r) = n! / (r! * (n-r)!). As you can see:(n choose 1) = n. so this can be simplified to F = (1-C)^D + D * C * (1-C)^(D-1) |
| Tanuki | 01 Mar 2009 3:20 p.m. PST |
Binomial distribution gives the probability of the required number of successes in n trials (= number of dice), given the probability of a single success. there's an easy way to do the calculation – if you have MS Excel, set up a table using the function BINOMDIST. Just say and I can e-mail you a copy of a working spreadsheet. |
| I Jim I | 01 Mar 2009 3:30 p.m. PST |
Of course you could calculate the chance of success, S directly: S = (D choose H) * C^H * (1-C)^(D-H) + (D choose H+1) * C^(H+1) * (1-C)^(D-(H+1)) +
+ (D choose D) * C^D * (1-C)^(D-D) [That last term:"(D choose D) * C^D * (1-C)^(D-D)" just equals "C^D"] |
| I Jim I | 01 Mar 2009 3:38 p.m. PST |
Here is an online binomial calculator: link Just put in n = D, p = C, and Prob X is at least H |
| Last Hussar | 01 Mar 2009 3:42 p.m. PST |
Probably a bad example, as only one failure needed- What If I am looking for 4 out of 7. Tanuki- I am using Open Office, but that seems to have virtually all the MS functions (plus a few extra). IanMHopping (at) AOL (dot) com Thanks for your help |
| Tanuki | 02 Mar 2009 5:31 a.m. PST |
Last Hussar – will drop you the spreadsheet this evening (I'm at work just now). |
| Old Warrior | 02 Mar 2009 7:53 a.m. PST |
Would You email the spreadsheet my way too! |
| Tanuki | 02 Mar 2009 8:24 a.m. PST |
OW – drop me an email at tanuki_derek at yahoo dot co dot uk and I'll mail it off to you! |
| Tanuki | 03 Mar 2009 2:30 a.m. PST |
Spreadsheet sent chaps – let me know if you don't receive it! |