I have been trying to work with random variables in Python and more denerally. My model works with large numbers and lohnormal distributions, but it is very hard to get a clear answer anywhere on the intuition of the parameters as various software packages see it, which stems from the fact that the mathematical explanations are equally unclear about what the parameters mean, or are even called.
My code Python Scipy code looks like this:
rv = lognorm(s=1., scale=100000., loc=0)
x = numpy.arange(1, 1000000, 1000)
plt.plot(x, rv.pdf(x))
plt.show()
When s=1 you get a graph that looks like a textbook lognormal dostribution, with e believable shape that would have the right means, mode, etc.
What I find is that as I INCREASE s, the plot gets tighter to the left, and does not flatten out as suggested by any text. By the time s=3 or 4, the graph looks like a spike at zero, and zero everywhere else.
s is the standard deviation of the underlying random variable X which is a normal with mean equal to ln(100000) and standard deviation equal to whatit should be to achieve the desired result. In my instance, a 10% random change (100,000 units) is what I want to model.
After hours of thinking, tinkering, and experimenting, I finally cut through the clutter and figured out the answer, which - having re-written the question - I will now give.
The tricky bit here is pulling back from the real world into the fictitious normally distributed RV, $X$, which is generating the lognormal $Y=e^x$. That underlying RV is normally distributed with a mean of $ln(1,000,000)$ which is 12.816. The trick is to go mentally back 'into the real world' and ask yourself "what would be the number if a one stnadrad deviation event occurred?" In my case that would be a 10% range, or 1,100,000 (or 900,000).
But the natural log of 1,100,000 is 12.919. This is only about.10 difference, so the underlying RV has mean 12.816 and stdev .10. Since stdev is what goes into the lognorm formula (often called 'shape'), it explains (1) how to get the thing to work and (2) why the 'shape' factor is usually so small (<2): when dealing with variations in the real world of reasonable sizes (plus or minus 50% standard deviations or less), the underlying RV $X$ has a very, very tight variance.
Hope this is helpful to others. I sure spent a lot of time and never found a good resource or answer.