Page 1 of 1

Random with Log Normal distribution

Posted: Fri Sep 15, 2023 2:49 pm
by Nub_User
Hi colleagues!
Can a variable with a random value following a log-normal distribution be implemented?
Thank you very much.

Re: Random with Log Normal distribution

Posted: Fri Sep 15, 2023 3:52 pm
by tomfid
Yes!

I usually do something like the following:

var = GeometricMean * EXP( GeometricSD*RANDOM NORMAL(-6,6,0,1,0) )

The GeometricMean has the same units as your target variable.

The GeometricSD is the standard deviation as a fraction of the mean, i.e. the standard deviation of LN(var/GeometricMean) and therefore dimensionless. I usually assign the unit "fraction" for clarity.

You could also write the inner part as RANDOM NORMAL(-6,6,0,GeometricSD,0), but then you might have to change the -6,6 bounds if the SD is significantly different from one. The way I've written it, the -6,6 bounds give you a six-sigma constraint, so you can draw a million values without hitting the bound. You can make these larger if desired, but the nice thing about keeping the GeometricSD outside the RANDOM NORMAL call is that it makes the bounds invariant.

Re: Random with Log Normal distribution

Posted: Fri Sep 15, 2023 6:54 pm
by Nub_User
Thank you very much Tom I will try it! :D :D :D :D