Two Plus Two Publishing LLC Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > >

Notices

Probability Discussions of probability theory

Reply
 
Thread Tools Display Modes
Old 04-23-2017, 09:29 PM   #1
DMMx69
old hand
 
DMMx69's Avatar
 
Join Date: Jul 2006
Location: This Mortal Coil
Posts: 1,677
Generalized Formula for Probability of Combination of Unequal Probabilities

Thread title probably not clear, but this is what I'm looking for:

I have 7 coins to flip, each weighted differently:

Coin: pHeads (and pTails simply 1-pHeads)

A: .54
B: .59
C: .66
D: .50
E: .49
F: .48
G: 45

What is the chance of getting 4 heads? 5 heads? etc.?

I can figure this out through (a lot) of multiplication of all the possible combinations, but is there any way to simplify this and generalize the formula for any number of coins, and any set of probabilities?

Thanks for any insight.
DMMx69 is offline   Reply With Quote
Old 04-23-2017, 10:46 PM   #2
DMMx69
old hand
 
DMMx69's Avatar
 
Join Date: Jul 2006
Location: This Mortal Coil
Posts: 1,677
Re: Generalized Formula for Probability of Combination of Unequal Probabilities

I semi-solved this using a ton of rand() functions in Excel and just counting the results. Simple enough to get a close answer after 1MM trials.

Still interested in a better math-based answer, however.

Thanks.
DMMx69 is offline   Reply With Quote
Old 04-23-2017, 11:22 PM   #3
whosnext
veteran
 
whosnext's Avatar
 
Join Date: Mar 2009
Location: California
Posts: 3,356
Re: Generalized Formula for Probability of Combination of Unequal Probabilities

Here are two links that may be of interest.

https://en.wikipedia.org/wiki/Poisso...l_distribution

http://forumserver.twoplustwo.com/25...n#post48554345
whosnext is offline   Reply With Quote
Old 04-24-2017, 10:20 AM   #4
nickthegeek
centurion
 
Join Date: Sep 2011
Posts: 169
Re: Generalized Formula for Probability of Combination of Unequal Probabilities

You asked a similar question some time ago. Actually, it's basically the same thing. You had events with multiple outcomes, while now you have just two outcomes for each event. In any case, you want the sum of them.

As BruceZ showed, this is a convolution problem. Luckily, R supports convolution and your problem can be solved defining a one-liner function:

Code:
genUnProb<-function(ph) {
    setNames(Reduce(function(x,y) convolve(x,rev(y),type="open"),Map(c,1-ph,ph)),0:length(ph))
}
where the argument ph is a vector with the heads probabilities. Also a one-liner for a simulation:
Code:
genUnProbSim<-function(ph,nsim=100000) {
   setNames(tabulate(colSums(matrix(rbinom(nsim*length(ph),1,ph),ncol=nsim))+1)/nsim,0:length(ph))
}
Now we get the results with your values:

Code:
ph<-c(.54,.59,.66,.50,.49,.48,.45)
convResult<-genUnProb(ph)
simResult<-genUnProbSim(ph)
cbind(convResult,simResult)
#    convResult simResult
#0 0.004676563   0.00445
#1 0.038610441   0.03924
#2 0.134457040   0.13646
#3 0.256406970   0.25401
#4 0.289556183   0.29007
#5 0.193854783   0.19301
#6 0.071310213   0.07168
#7 0.011127806   0.01108
As you can see, there is a good agreement between the convolution and the simulation results (if you run the code, you'll have slightly different values for simulation result of course).
nickthegeek is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Forum Jump


All times are GMT -4. The time now is 03:06 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Search Engine Optimisation provided by DragonByte SEO v2.0.33 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Copyright ę 2008-2010, Two Plus Two Interactive
 
 
Poker Players - Streaming Live Online