[R] faster computation of cumulative multinomial distribution

Alberto Vieira Ferreira Monteiro albmont at centroin.com.br
Sat Mar 31 03:55:50 CEST 2007


Theo Borm wrote:
>
> Think of a sort of "power roulette", played with 58 balls
> simultaneously, with a wheel containing 36 red/black slots of unequal
> size, and 1 green slot. I need to calculate the probability that each of
> the 36 red/black slots contains at least one ball.
>
Ah, now we come to a more precise problem :-)

> I have a hunch that it won't work as my p vector typically contains
> values like:
>
> p<-c(0.99, 0.005, 0.003, 0.001, 0.0005, 0.0003, 0.0001, 0.00005,
> 0.00003, 0.00002).
>
So you should expect that only 1/50000 will be in the low-prob
hole in the average?

> keeping in mind that the first "green" slot (0.99) represents my
> "remainder" class (which may be empty), and calculating the probability
> that with 9 trials I get exactly one in each of the other  slots:
>
> p=0.005*0.003*0.001*0.0005*0.0003*0.0001*0.00005*0.00003*0.00002*9!
>
> =~ 2.45*10^-27
>
> so, I'm looking for very rare events.
>
Indeed you are!

> to calculate this figure even marginally /accurately/ with a monte carlo
> simulation would require in well excess of 4*10^26 iterations.....
>
Hmmm.... That's right. No way to do a Monte Carlo here!

Alberto Monteiro



More information about the R-help mailing list