I use Perl to model a random variable ( Y), which is the sum of some independent random variables Bernoulli ( X_i), each of which has a different probability of success ( p_i). Formally Y=Sum{X_i}, where Pr(X_i=1)=p_iand Pr(X_i=0)=1-p_i.
I am interested in quickly responding to requests such as Pr(Y<=k)(where k).
I am currently using random simulations to answer such requests. I randomly draw each X_iaccording to it p_i, then summarize all the values X_ito get Y'. I repeat this process several thousand times and return some times Pr(Y'<=k).
Obviously, this is not entirely accurate, although the accuracy increases significantly as the number of simulations they use increases.
Can you imagine a reasonable way to get an accurate probability?
source
share