Lognormal random numbers centered around a large value

I am trying to create random numbers from a lognormal distribution using numpy / scipy.

The average value is set to 2000, and sigma is 800.

If I create my random valus using numpy.random.lognormal (mean = 2000, sigma = 800, size = 10000) everything I get is very high or the number inf.

Is there any way around this?

+2
source share
1 answer

Be careful: the mean and sigma arguments correspond to the distribution of the distribution lognormal ; the actual arithmetic mean of the distribution exp(mean + sigma**2/2) , which is estimated inf in the standard floating point with double precision, when mean=2000 and sigma=800 .

See http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.lognormal.html#numpy.random.lognormal and also http://en.wikipedia.org/wiki/Log-normal_distribution for more details.

+5
source

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


All Articles