Probability mass function with variable probability? [duplicate]

I would like to calculate the probability of a certain result coming out at least 'x' times in 'n' attempts when the probability of result varies on every attempt; all attempts are independent events.

I found that I can use PMF when I have the same probability for every event, e.g. probability of 3 tails in 5 coin tosses. But there the probability is 50% (If we use a fair coin) for all events. When the probability changes on each attempt I'm lost.

Let's say that the probabilities of outcomes in 5 events are: 30% in the first, 35% in the second, 50% in the third, 42% for the fourth, and 25% in the fifth. What are the probabilities of it happening at least 1 in the 5, what are the probability of 2 of the 5, 3/5, 4/5 and 5/5?

I don't need the probability of the hypothetical case I'm using here as example just the formula for calculate this kind of probability or the name of this kind of thing so I can search it.

• Will a recursive formula do? I think a solution in closed form will be exceedingly painful. Mar 15 '18 at 15:10
• @StephanKolassa Yes, any approach that yields a correct result is welcomed. I'm coding a script to calculate this kind of probability so I will not be making the calculations by hand, and I'm not calculating big enough sets for performance to be an issue. Mar 15 '18 at 15:30

Calculations tend to become quite cumbersome with this distribution, but you can rely on available algorithms. For example, you can look at R package poibin, which includes a command for the cdf (since you need the probability of at least $x$ successes out of $n$).