Probabilities of set number of events happening from multiple different probability events

probability

I have 10 independent events and I would like to be able to work out the probability of EXACTLY 2,3,4,5 etc. happening, I can gain the probability of 1 happening by taking the probability of the sum of any happening and I can get the probability of more than 1 happening by taking away the probability of 0 happening, I can also get chances of 2 happening by taking away the chance of just 1 happening from the chance of 0, but I am struggling with how I can do this with exactly 2 without individually calculating the chances of event 1 & 2, chances of event 1 & 3, so on and so forth. Is there a way to do this with Excel/Google Sheets? I looked into binomial distribution but I think this requires the probability of each event to be the same.

Not a hugely maths savvy person, so your patience (and simplicity) in answering would be much appreciated.

The table shows the probabilities I have for the 10 events.

table

Best Answer

Here is a python script that computes the probabilities you want:

from collections import defaultdict

p = [.2174, .3759, .4673, .0769, .0357, .2632, .2632]
N = len(p)

def bitsum(n):
    'Number of 1 bits in n'
    count = 0
    while n:
        count +=1
        n &= n-1
    return count

def prob(v):
    '''
    v is a bit vector indicating which events occurs
    v[k]==1 iff event k occurs
    '''
    answer = 1
    for k in range(N):
        v,r = divmod(v,2)
        answer *= p[k] if r else (1-p[k])
    return answer

exact = defaultdict(float)
for v in range(2**N):
    exact[bitsum(v)] += prob(v)

for k in range(N+1):
    print('probability exactly', k, 'events occur', exact[k])

print('Sum of computed probabilities', sum(exact.values()))

This produces the output:

probability exactly 0 events occur 0.12572940926350773
probability exactly 1 events occur 0.32590285691607773
probability exactly 2 events occur 0.3297864319159991
probability exactly 3 events occur 0.1671225468059581
probability exactly 4 events occur 0.0449221573418514
probability exactly 5 events occur 0.006158839703878074
probability exactly 6 events occur 0.0003704954218414138
probability exactly 7 events occur 7.262630886494916e-06
Sum of computed probabilities 1.0000000000000002

The script just computes the probability of each of the $128$ possible outcomes, and tosses it into the appropriate bin. Since the last $3$ events never occur, I just ignored them.