Videos
How can I calculate d (binomial probability distribution) using excel?
My finite math professor showed me how to calculate binomial distributions in excel and my mind is seriously blown.
Probability Distribution with different probabilities
I put together an exact calculator for you:
Google Drive Link to Xlsx File
Here's the rundown:
With 9 independent events, there are 29 = 512 possible outcomes. (However, with 4 of your probabilities set to 1, you only really need to list 25 = 32 rows to solve this problem.) Naturally, one could list the outcomes in order several ways, but I choose a simple binary approach:
0 = {0,0,0,0,0,0,0,0,0}
3 = {1,1,0,0,0,0,0,0,0}
365 = {1,0,1,1,0,1,1,0,1}
and so on. There's a neat formula in the second sheet where I expand ordinal numbers by row into 10 columns of binary coefficients:
B3 =IF(MOD($A3,2^ COLUMNS($A$1:A$1))>=(2^ (COLUMNS($A$1:A$1)-1)),1,0)
which basically for a number in column A, will return 1 in Column B if it is odd, return 1 in Column C if it has a remainder of 2 or 3 after mod4, return 1 in Column D if it has a remainder of 4,5,6,7 after mod8, etc. for the next 10 columns.
I use this to generate binary coefficients for all 29 possibilities, neatly in columns underneath the 9 probabilities that can be input. (Really there's 10 columns and 1024 rows because I extended and generalized the problem. Overkill.)
The next formula is the critical formula for your calculation, and requires some generalization of your explanation outlined in the OP.
The probability of an outcome (Ptot) , given the probability of individual events (Pn), and the binary coefficients of the outcome (Xn), can be expressed as follows:
Ptot = Product from n=1 to 9 of ( Pn * Xn + (1-Pn) * (1-Xn) )
So when Xn is 1, you use the base probability Pn, but when Xn = 0, you use the complementary probability 1-Pn for each event.
This extends into Excel with an Array formula:
L3 ={PRODUCT($B$1:$K$1 * B3:K3 + $B$2:$K$2 * (1-B3:K3))}
which has to be entered with ctrl+shift+enter. Here, $B$1:$K$1 refers to the static series of event probabilities, while B3:K3 refers to the line-by-line changing binary coefficients.
$B$2:$K$2 refers to the complementary probabilities, but would be equivalent to (1-$B$1:$K$1). Similarly, it saves column/row space to use (1-B3:K3) to refer to the complementary binary coefficients.
So now we have probabilities calculated for each individual outcome, and all we have to do is sum it up! Excel is great at conditional summing with SumIf and a helper column, so column M sums up the number of positive outcomes in each row: e.g. 365 -> {1,0,1,1,0,1,1,0,1} -> 6 positive outcomes.
Back on Sheet 1, the formulas for summing the total probabilities of outcomes of the same number of positives becomes:
E3 =SUMIF(Sheet2!$M$3:$M$1026,"="&Sheet1!D3,Sheet2!$L$3:$L$1026)
where Sheet 2 column M is our total positive outcomes, Sheet 1 column D is our ordinal numbers 0-10, and Sheet 2 column L is our probabilities by individual outcome.
We get final results to the tune of:
4 0.003213494526 5 0.044353711100 6 0.214564004339 7 0.419518775123 8 0.271788119707 9 0.046561895205Let me know if you have any questions! I really enjoyed thinking about this on my (rather long) commute this morning. :)
Ed: I also put a minimalist calculation sheet together - 10 Columns, 33 rows! (it could fit in 8 columns, 35 rows too)
More on reddit.comYour Friends the Hypergeometric and Binomial Distributions
For those who are too lazy to write formulas, there's a super simple Hypergeometric Calculator here:
https://www.andrew.cmu.edu/user/kmliu/mtg_calculator.html
More on reddit.comI figured out how to do everything else through excel, but can’t figure out the binomial probability distribution of X is greater than or equal to part of this. Anyone know how to do this? I’ve included an image here and in the comments.
https://i.redd.it/i2du0gir48ub1.jpg