Please teach me probability so I don't have to keep asking

General questions, debates, and rants about RPGs

Moderator: Moderators

User avatar
Prak
Serious Badass
Posts: 17353
Joined: Fri Mar 07, 2008 7:54 pm

Please teach me probability so I don't have to keep asking

Post by Prak »

Can someone please explain to me how to figure out probability so I don't have to ask every single time I want to know the probability of something?

I know the probability of a single event having a certain outcome. Getting a 1 on a d6 has a 1 in 6 chance of occurring, and getting a 5 or 6 on a d6 has a 1 in 3 and so on.

Anything more complicated, like rolling two 5s in 2+d6 or the probability of getting a pair in a hand from a fresh deck of cards, I'm lost. So could one of the esteemed mathematical competents of the Den please remedy the shitty teaching of my High School math teacher?
Cuz apparently I gotta break this down for you dense motherfuckers- I'm trans feminine nonbinary. My pronouns are they/them.
Winnah wrote:No, No. 'Prak' is actually a Thri Kreen impersonating a human and roleplaying himself as a D&D character. All hail our hidden insect overlords.
FrankTrollman wrote:In Soviet Russia, cosmic horror is the default state.

You should gain sanity for finding out that the problems of a region are because there are fucking monsters there.
User avatar
erik
King
Posts: 5868
Joined: Fri Mar 07, 2008 7:54 pm

Post by erik »

User avatar
Prak
Serious Badass
Posts: 17353
Joined: Fri Mar 07, 2008 7:54 pm

Post by Prak »

Much like I could have just googled "transformers reuse of names" but preferred to ask Shrapnel, because he knows his stuff and would give me a simpler, succinct answer, I could google "how do I probability" but a Denner is going to actually converse with me in a way I can understand without me spending the next hour reading a textbook.
Cuz apparently I gotta break this down for you dense motherfuckers- I'm trans feminine nonbinary. My pronouns are they/them.
Winnah wrote:No, No. 'Prak' is actually a Thri Kreen impersonating a human and roleplaying himself as a D&D character. All hail our hidden insect overlords.
FrankTrollman wrote:In Soviet Russia, cosmic horror is the default state.

You should gain sanity for finding out that the problems of a region are because there are fucking monsters there.
User avatar
DrPraetor
Duke
Posts: 1289
Joined: Thu Apr 02, 2009 3:17 pm

Post by DrPraetor »

If you have two independent events, you multiple the probabilities together.

So, for example, if you have 2D6 and you want to know your chances of rolling a 12, your chance is 1/6 * 1/6 = 1/36.

This gets more complicated if you have multiple "events" (this is actually the technical term you'd use in a probability course) which correspond to the same outcome. So, for example, you have a 1/36 chance of rolling 5 + 6 = 11; and you have a 1/36 chance of rolling 6 + 5 = 11; so your chance of rolling 11 is 2/36.

For dice-rolling, those probabilities are called "combinatorial coefficients", and they get pretty hairy, for example if you are calculating your chances of rolling 19 on 4D6 you have to add up:
6,6,6,3 = 1/1296 (which is 1/6 * 1/6 * 1/6 * 1/6)
6,6,3,6 = the same, etc. etc.
6,3,6,6
3,6,6,6
6,6,5,4
etc. etc.

A definition of how combinatorial coefficients are calculated is here:
https://en.wikipedia.org/wiki/Binomial_coefficient

But these things are famously hairy and can get very big, so no-one does these calculations by hand. I use this: http://anydice.com/

which works pretty well.
Chaosium rules are made of unicorn pubic hair and cancer. --AncientH
When you talk, all I can hear is "DunningKruger" over and over again like you were a god damn Pokemon. --Username17
Fuck off with the pony murder shit. --Grek
User avatar
Prak
Serious Badass
Posts: 17353
Joined: Fri Mar 07, 2008 7:54 pm

Post by Prak »

Ok, thank you.

I was thinking about Dead Man's Hand again and I keep wanting to use actual cards in some way, but if I want to do that, I need to know probabilities associated with poker hands. And I'd rather crunch those numbers myself than dredge through pages online.

edit: and figuring out their fucking terminology....
Last edited by Prak on Thu Jul 02, 2015 3:45 am, edited 1 time in total.
Cuz apparently I gotta break this down for you dense motherfuckers- I'm trans feminine nonbinary. My pronouns are they/them.
Winnah wrote:No, No. 'Prak' is actually a Thri Kreen impersonating a human and roleplaying himself as a D&D character. All hail our hidden insect overlords.
FrankTrollman wrote:In Soviet Russia, cosmic horror is the default state.

You should gain sanity for finding out that the problems of a region are because there are fucking monsters there.
User avatar
RadiantPhoenix
Prince
Posts: 2668
Joined: Sun Apr 11, 2010 10:33 pm
Location: Trudging up the Hill

Post by RadiantPhoenix »

I am tired and don't have a whiteboard to explain things on, so this is probably not the best explanation.

The basic trick of statistics with evenly-weighted random numbers is looking at all the different things that could happen, figuring out how many of them are the thing you want to determine the probability of, and dividing that number by the total.

The other trick is figuring out how to combine simple, common probabilities into large, complicated, specific-case probabilities.

Dice

Rolling large numbers of dice and adding their numbers is a bit complicated, but for 2 dice you can use a square:
123456
1
2
3
4
5
6

Each box is equally likely, so you can count the number that meet a criteria, and then divide them by the total number of boxes. Spreadsheets are helpful.

Binary tests (e.g., dicepools) can be mathed with the binomial distribution:

Code: Select all

P(y hits on x dice) = y! / (x! * (x - y)! ) * p_hit ^ y * (1 - p_hit) ^ (x - y)
e.g., if your TN is 5 on a d6, and you roll 10 dice, your probability of rolling 3 hits is:

Code: Select all

P(3 on 10) = 10! / ( 3! * 7! ) * (1/3) ^ 3 * (2/3) ^ 7
= 10 * 9 * 8 / (3 * 2 ) * (1/3)^10 * 2^7
= 5 * 3 * 2^3 / (3 ^ 10) * 2^7
= 2^10 / 3^10 * 15
= 0.26
And your probability of rolling no more than 3 hits is:

Code: Select all

 P( 3 on 10 ) + P( 2 on 10 ) +  P( 1 on 10 ) +  P( 0 on 10 ) 
At which point I whip out my handy-dandy spreadsheet program (LibreOffice Calc), and make the following table:
x_hitsn_diceP_hitP_x
0100.3333333333= fact(B2) / ( fact(A2) * fact( B2 - A2 ) ) * C2 ^ A2 * (1 - C2) ^ (B2 - A2)
1100.3333333333
2100.3333333333
3100.3333333333
4100.3333333333
5100.3333333333
6100.3333333333
7100.3333333333
8100.3333333333
9100.3333333333
10100.3333333333

And then copy-paste the formula into the rest of that column, yielding:

Code: Select all

0.0173415299
0.0867076496
0.1950922116
0.2601229487
0.2276075801
0.1365645481
0.056901895
0.0162576843
0.0030483158
0.0003387018
1.69350878084303E-005
Then I add the relevant values, yielding 0.56, or 56%

Cards

In the specific scenario (getting a double), I would first calculate the probability of not getting a double, and then subtract that from 1 to figure out the probability of doing so. If you don't have a double, then all of your cards have different numbers.

There are four of each number in the full deck, so once you've drawn one card of a given number from the deck, the probability of drawing a second is (4 - 1) / (52 - X), where X is the number of cards already drawn on this draw.

However! You don't just have to not draw another card of that number, you have to not draw another card of any other number you've already drawn. Thus, the probability of breaking the streak on the Xth draw is (4 - 1) * (X - 1) / (52 - ( X - 1 )), and the probability of not breaking the streak is one minus that number, or P_{no break}( X ) = ((52 - ( X - 1 )) - (4 - 1) * (X - 1) ) / (52 - ( X - 1 )) = 4 * (13 - (X - 1)) / (52 - ( X - 1 )). This calculation assumes that you've already made it to the Xth draw without breaking the streak, so we actually have to multiply the probabilities together, from 1 to 5

Code: Select all

 P_{no break}(1) * P_{no break}(2) * P_{no break}(3) * P_{no break}(4) * P_{no break}(5)
 = 1 * 0.9411764706 * 0.88 * 0.8163265306 * 0.75
 = 0.5070828331
This is the probability of not drawing a pair, so we subtract that from 1 and get a 49.3% chance of drawing a pair in 5 cards.
hyzmarca
Prince
Posts: 3909
Joined: Mon Mar 14, 2011 10:07 pm

Post by hyzmarca »

It's simple enough. Number of outcomes that you want divided by total number of possible outcomes.


5+5 on 2d6

Simple enough. How many different possibilities are there.

1+1
1+2
1+3
1+4
1+5
1+6

2+1
2+2
2+3
2+4
2+5
2+6

3+1
3+2
3+3
3+4
3+5
3+6

4+1
4+2
4+3
4+4
4+5
4+6

5+1
5+2
5+3
5+4
5+5
5+6

6+1
6+2
6+3
6+4
6+5
6+6

Count them, there's total. It's faster if you just multiply though, 6 times 6.

Only 1 outcome gives you 5+5. So that probability is 1/36

Lets say instead you want to get a 10. 4+6, 5+5, and 6+4 give you 10. That's three outcomes that give you want you want. A probability of 3/36. Or 1/12.

Past outcomes - The probability of a past outcome is either 1 or 0. If you've already rolled a 5, the probability of rolling a second one is 1/6, not 1/32. However, if you rolled any number other than 5 on your first die, the probability of rolling 5+5 is 0, of course.



Deck of cards is more complex. No repeats.

Drawing a specific number or face of any suit is a 4/52 chance. Drawing the same number or face again is 3/51. The card gets removed from the deck, reducign the number of possibilities. But it also reduces the number of outcoems that you want by 1.

So the chance of getting a double on two cards is 12/2652, 1/221.

How about better probability.

Roll 3d6, drop 1. Target 5.
You win on 5+5+x, 5+x+5, or x+5+5 There are 6 possibilities for x, since it doesn't matter. So there are 18 ways for you to win.

Since you're rolling 6 six sided dice, the total number of possibilities are 6*6*6 = 216

18/216=1/12

5 card stud?

52*51*50*49*48 = 311,875,200 possible hands.

How many of those are pairs? A little less than half. No I don't want to write down all hundred and fifty something million of them.
TiaC
Knight-Baron
Posts: 968
Joined: Thu Jun 20, 2013 7:09 am

Post by TiaC »

Poker hands are even nastier. You see, whenever you draw a card, the deck now has one fewer card in it, so the probabilities are different. This means you can't treat it like rolling dice where all the operations are similar.

So, to calculate the odds in a hand of cards in a deck of your own making, you'll need the binomial coefficient. This is usually known as "X choose Y" in this context. It is simply the number of ways to choose X cards from a deck of Y cards. Its value is Y!/(X!*(Y-X)!). This is how many possible hands there are. For example, there are 2,598,960 five-card poker hands.

Then, you have to find out how many of those hands are what you want. So, there are 13 types of four-of-a-kind, and for each there are 48 possibilities for the fifth card. Therefore, there are 624 possible four-of-a-kind hands.

The final probability is (number of hands that are what you want) divided by (total number of hands). In my above example, this gives you 624/2,598,960 or .024%.
virgil wrote:Lovecraft didn't later add a love triangle between Dagon, Chtulhu, & the Colour-Out-of-Space; only to have it broken up through cyber-bullying by the King in Yellow.
FrankTrollman wrote:If your enemy is fucking Gravity, are you helping or hindering it by putting things on high shelves? I don't fucking know! That's not even a thing. Your enemy can't be Gravity, because that's stupid.
User avatar
DrPraetor
Duke
Posts: 1289
Joined: Thu Apr 02, 2009 3:17 pm

Post by DrPraetor »

You're missing a component, because:
A,A,A,A,2
is a different hand then:
A,A,A,2,A

So not only are there 48 possibilities of the fifth card, there are five different places that the fifth card could be, among the five cards on the top of the deck.

For poker pairs, the calculation is this:
1) I draw a card.
2) I draw another card, there are 3/51 cards in the deck that match my first card, so 48/51 chance that I *didn't* match.
3) IF the first two cards don't match, there are 6/50 cards in the deck that match, so 44/50 chance that I *didn't* match.
4) 9/49 -> 40/49 that I *didn't* match any of the three cards I've drawn.
5) 12/48 -> 36/48 " " "

So the chance of *not* drawing a pair is 48/51 * 44/50 * 40/49 * 36/48 = 50.7%, so your chance that you *will* draw a pair (or better!) is 49.3%.

Note that you could get the same answer by adding up all the hands which *are* pairs and then dividing that by the number of hands. You'd start out by saying there are 13 different cards to have pairs of, for each of those there are 6 combinations of suits (13 * 6), the first of those could be any of the five cards you drew (13 * 6 * 5), the second of those could be any of the other four cards you drew (13 * 6 * 5 * 4), and then the other three could be *any other card in the deck* (13 * 6 * 5 * 4 * 50 * 49 * 48); you can divide that by (52 * 51 * 50 * 49 * 48) which is the total number of hands and you can see by eye that you'll get a little less than 50%.
Chaosium rules are made of unicorn pubic hair and cancer. --AncientH
When you talk, all I can hear is "DunningKruger" over and over again like you were a god damn Pokemon. --Username17
Fuck off with the pony murder shit. --Grek
TiaC
Knight-Baron
Posts: 968
Joined: Thu Jun 20, 2013 7:09 am

Post by TiaC »

Since the question was regarding poker hands, I was ignoring ordering. If you care about that, both numerator and denominator are multiplied by 120, but that doesn't affect your chance of drawing four-of-a-kind.
virgil wrote:Lovecraft didn't later add a love triangle between Dagon, Chtulhu, & the Colour-Out-of-Space; only to have it broken up through cyber-bullying by the King in Yellow.
FrankTrollman wrote:If your enemy is fucking Gravity, are you helping or hindering it by putting things on high shelves? I don't fucking know! That's not even a thing. Your enemy can't be Gravity, because that's stupid.
User avatar
Josh_Kablack
King
Posts: 5318
Joined: Fri Mar 07, 2008 7:54 pm
Location: Online. duh

Re: Please teach me probability so I don't have to keep asking

Post by Josh_Kablack »

Prak wrote:Can someone please explain to me how to figure out probability so I don't have to ask every single time I want to know the probability of something?

I know the probability of a single event having a certain outcome. Getting a 1 on a d6 has a 1 in 6 chance of occurring, and getting a 5 or 6 on a d6 has a 1 in 3 and so on.

Anything more complicated, like rolling two 5s in 2+d6 or the probability of getting a pair in a hand from a fresh deck of cards, I'm lost. So could one of the esteemed mathematical competents of the Den please remedy the shitty teaching of my High School math teacher?
Okay, I trust other Denizens will get the advanced concepts some I\m gonna start with a few baby steps, which you may already know:

Starting at the very basic longhanded way:

Probability is the chance of one specific event (or set of events) happening out of the set of all possible events that can happen.

So as you already know if you roll 1d6, there is a 1 in 6 chance of getting any specific number. Extending that to 2d6 extends the set of possible results from 6 to 36, even though it only extends the set of possible sums from 2 to 12.
First DieSecond DieSum
112
123
134
145
156
167
213
224
235
246
257
268
314
325
336
347
358
369
415
426
437
448
459
4610
516
527
538
549
5510
5611
617
628
639
6410
6511
6612

Now as you can see, there are 6 combinations of 2 dice which add up to 7, making 7 the most likely result Conversely, there are only single combinations which add up to the endpoints of 2 and 12.

You can also see that the set of possible outcomes went from 6 for 1d6 to 36 for 2d6. With each additional d6, it's going to be multiplied by another 6, meaning that your set of potential outcomes grow exponentially with the number of dice. While modern spreadsheets and pocket computers make it possible to do this sort of exhaustive listing and hand counting for sets of 3d6 (216 possible outcomes), 4d6 (1296 possible outcomes), by the time you get to HERO system 12d6+ damage rolls, you're looking at sets of potentinals with over 2 billion possibilities - and exhaustive listing and counting is not practical at those scales. Hence mathematicians have figured out various formulae the liklihood of events, and the application of probability involves learning those formulae and learning when to apply them.

And I'm sure other Denizens have already started beating some of those into you, but remember that you can often use smaller instances to go back and check that you are applying things correctly via exhaustive listing and simple counting.


Now, moving on to the other basic, and perhaps overly obvious concept you'll need to make heads or tails of anything card related: There are a finite number of cards in a deck. If you roll a (fair) d6 5 times in a row, you have a 1 in 6 chance of rolling a 1 on the fifth roll, regardless of what the previous 4 rolls were. If you draw a 5 card hand from a standard 52-card deck, the odds of drawing an Ace on as your fifth card can be as high as 4-in-48 (in the case where all Aces are still in the deck) or as low as actually impossible (in the case where all four Aces are already in your hand).
"But transportation issues are social-justice issues. The toll of bad transit policies and worse infrastructure—trains and buses that don’t run well and badly serve low-income neighborhoods, vehicular traffic that pollutes the environment and endangers the lives of cyclists and pedestrians—is borne disproportionately by black and brown communities."
User avatar
erik
King
Posts: 5868
Joined: Fri Mar 07, 2008 7:54 pm

Post by erik »

I wasn't being totally snarky with wolfram|alpha. Once you're used to the language you can plug in dice or card probabilities and get some nice illustrations of the odds. I've used it when I wanted to see quick bell curves for dice.

http://www.wolframalpha.com/input/?i=ro ... +5s+in+2d6

http://www.wolframalpha.com/input/?i=pair+in+a+5+card
Blade
Knight-Baron
Posts: 663
Joined: Wed Sep 14, 2011 2:42 pm
Location: France

Post by Blade »

Something important in the context of game design is to understand that a probability is just a probability.

Even if you have a system where 80% of the rolls should get in some range, you could very well end up with a game where 80% of them will fall out of that range. It's less likely, but it's still possible.

So while it's important to consider the expected value of your bell curve, you shouldn't just focus on it and ignore the rest of the bell curve.
User avatar
RadiantPhoenix
Prince
Posts: 2668
Joined: Sun Apr 11, 2010 10:33 pm
Location: Trudging up the Hill

Post by RadiantPhoenix »

Does Wolfram Alpha not count three-of-a-kind or four-of-a-kind as a pair? ( https://en.wikipedia.org/wiki/Poker_pro ... oker_hands )
User avatar
Chamomile
Prince
Posts: 4632
Joined: Tue May 03, 2011 10:45 am

Post by Chamomile »

The odds of even getting a pair in a five-card hand are about 1 in 2, which means unless high cards count for almost all of your "rolls," 50% success odds are the highest you can have.
violence in the media
Duke
Posts: 1727
Joined: Tue Jan 06, 2009 7:18 pm

Post by violence in the media »

Chamomile wrote:The odds of even getting a pair in a five-card hand are about 1 in 2, which means unless high cards count for almost all of your "rolls," 50% success odds are the highest you can have.
Not if you allow for drawing extra cards when making your hand. If a character ability allows them to draw 7 cards to look for their pair when the game calls for a 5 card draw, you've got a 73.88% chance of getting your pair.

If the intention is for the whole table to play rounds of poker or whatnot for action resolution, that's probably not going to work. But if you're just drawing and hunting for pairs or straights, extra cards are fine.
User avatar
deaddmwalking
Prince
Posts: 3891
Joined: Mon May 21, 2012 11:33 am

Post by deaddmwalking »

If you're trying to use Poker Hands, figuring the probabilities yourself is probably more work than you need to do. Having a sense of how to calculate the odds are good, but adjusting for other draws is complicated under any circumstances... With multiple players and/or discards, things get crazy hard for the casual game developer.

You might want:

https://en.wikipedia.org/wiki/Poker_probability
User avatar
Prak
Serious Badass
Posts: 17353
Joined: Fri Mar 07, 2008 7:54 pm

Post by Prak »

Well, poker hands is what brought it up, but I also just generally want to get better at probability because it's ridiculous to have to ask about it every time I need to know something.
Cuz apparently I gotta break this down for you dense motherfuckers- I'm trans feminine nonbinary. My pronouns are they/them.
Winnah wrote:No, No. 'Prak' is actually a Thri Kreen impersonating a human and roleplaying himself as a D&D character. All hail our hidden insect overlords.
FrankTrollman wrote:In Soviet Russia, cosmic horror is the default state.

You should gain sanity for finding out that the problems of a region are because there are fucking monsters there.
User avatar
angelfromanotherpin
Overlord
Posts: 9745
Joined: Fri Mar 07, 2008 7:54 pm

Post by angelfromanotherpin »

There are specific poker-probability programs with astounding comprehensiveness. One of my friends' brothers was making a living at online poker, and that was one of his main tools. It literally told him what the odds were that each player at the table would win (given visible information).
User avatar
Lokathor
Duke
Posts: 2185
Joined: Sun Nov 01, 2009 2:10 am
Location: ID
Contact:

Post by Lokathor »

If you decide to go with dice instead, http://topps.diku.dk/torbenm/troll.msp can help you quite a bit to display odds of all sorts of ways of handling dice.
[*]The Ends Of The Matrix: Github and Rendered
[*]After Sundown: Github and Rendered
User avatar
codeGlaze
Duke
Posts: 1083
Joined: Wed Oct 05, 2011 9:38 pm

Post by codeGlaze »

So, to hijack, I'm too old/busy to wasting fucking 15 minutes per round to "miss" during a turn. (I'm sure we can see how that's a spiritually linked thought process to probability. >.> )

Has The Den ever walked down the road of creating d20 hacks to make every turn useful in some way?
User avatar
angelfromanotherpin
Overlord
Posts: 9745
Joined: Fri Mar 07, 2008 7:54 pm

Post by angelfromanotherpin »

codeGlaze wrote:So, to hijack, I'm too old/busy to wasting fucking 15 minutes per round to "miss" during a turn. (I'm sure we can see how that's a spiritually linked thought process to probability. >.> )

Has The Den ever walked down the road of creating d20 hacks to make every turn useful in some way?
I think there was some talk of that for TNE. The idea was that everyone would have a short list of effects that were used with their Swift-equivalent action and weren't subject to failure chances. So every turn you had your Maneuver, your dramatic-but-unreliable Strike action, and your small-but-reliable Press effects.
User avatar
erik
King
Posts: 5868
Joined: Fri Mar 07, 2008 7:54 pm

Post by erik »

codeGlaze wrote:So, to hijack, I'm too old/busy to wasting fucking 15 minutes per round to "miss" during a turn. (I'm sure we can see how that's a spiritually linked thought process to probability. >.> )

Has The Den ever walked down the road of creating d20 hacks to make every turn useful in some way?
If it takes 15 min and actions are just hit or miss then maybe the 15 min is the problem rather than the binary output. I'm ok with hit/miss primarily because the conceit is that I will have another shot rolling around real soon.

You could convert attack + damage rolls into averages. Know your average damage and multiply by probability of hitting. Calculators or spreadsheet tables required. Won't speed things up but you are always doing something.
User avatar
codeGlaze
Duke
Posts: 1083
Joined: Wed Oct 05, 2011 9:38 pm

Post by codeGlaze »

@Erik : the 15 minute rounds are definitely the main issue. But it's not one that can easily be pared down with out kicking people out.

So I suppose ideas for running big groups would be beneficial, too.

In any case, I still fucking hate "swing and a miss!" turns. I, personally, just don't have the patience any more. XD

I'll have to dig through TNE's conversations again for ideas.
User avatar
Hiram McDaniels
Knight
Posts: 393
Joined: Mon Sep 15, 2014 5:54 am

Post by Hiram McDaniels »

What I wonder about is the effect standard deviation has on die mechanics.

I know that stdev matters for effects that rely on outlier events (like critical hits/misses on a d20), but what about the relative value of bonuses? For instance, I noticed that in d20 games circumstantial bonuses range from +2 (~stdev/2) to +5(~stdev) to +10 (~2*stdev) and I've always wondered if this was intentional.
Last edited by Hiram McDaniels on Sun Jul 05, 2015 4:44 pm, edited 2 times in total.
The most dangerous game is man. The most entertaining game is Broadway Puppy Ball. The most weird game is Esoteric Bear.
Post Reply