mwc-random icon indicating copy to clipboard operation
mwc-random copied to clipboard

Generators for Poisson and Binomial distributions with different tradeoffs

Open Shimuuar opened this issue 12 years ago • 5 comments

Currently library allows to generate Poisson and binomial random variate using condensed tables algorithm. It is very fast but require building lookup table which is costly. It makes this algorithm unsuitable for cases when only few samples for given parameters are required. For examples when parameters are random variables themselves

Shimuuar avatar Nov 22 '13 10:11 Shimuuar

There's post about algorithm for generation of Poisson random variates. Algorithm is noce and simple but requires dependency on math-functions (it needs logFactorial).

http://www.johndcook.com/blog/2010/06/14/generating-poisson-random-values/

Shimuuar avatar Feb 18 '15 21:02 Shimuuar

I am trying to figure out whether the issue I have is related. My system is using many GB (I last stopped it at 25 GB!) of memory to do something that perhaps ought to be simple:

> withSystemRandom . asGenIO . sample $ poisson 10000

I guess this is from the table generation. Is this expected given the current setup?

cspollard avatar Apr 03 '17 07:04 cspollard

Yes. It's problem with condensed tables. See #59

Shimuuar avatar Apr 23 '17 14:04 Shimuuar

This is what R uses, might be of help for a possible implementation.

jarandaf avatar Sep 28 '17 14:09 jarandaf

Thank you! Although I don't think I'll have time anytime soon

Shimuuar avatar Sep 28 '17 14:09 Shimuuar