How can I effectively model the sum of Bernoulli random variables?

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?

+3
source share
3 answers

Firstly, I would not use the built-in for this rand, which is too dependent on the implementation of the C base library to be reliable (see, for example, a blog post indicating that the range randon Windows has a capacity of 32,768).

-, , Rand:: MersenneTwister Random.org CDF Y, , Y . Y , CDF, , .

Wikipedia:

.

, n / p1, & hellip;, pn. ( )

- . :

, (cdf),

+3

, , . Convolution , p_i.

, CDF, .

+1

Source: https://habr.com/ru/post/1779570/


All Articles