Choose random inputsLesson 12 of 76 · 7 min
Keep positive quantities positive
Interpret lognormal parameters on their underlying log scale.
The exponential function exp(z), also written e to the power z, is positive. Here e is approximately 2.718. Its inverse is the natural logarithm log: exp(log(10))=10 and log(exp(2))=2. Logs turn multiplication into addition. A lognormal draw is exp(Z) for a normal draw Z, so it stays positive.
For lognormal X, log(X) has normal mean and SD . Its median is and its mean is . With log mean log(10) and log SD 0.7, the median is 10 while the mean is about 12.78. These are log-scale parameters, not the positive outcome's arithmetic mean and SD.
Multiplicative variation can support a lognormal model when the mechanism and evidence fit. Passing an average cost directly as the generator's mean usually gives a very different distribution: a desired median 10 needs log_mean=log(10). Increasing log_sd spreads the positive outcomes without changing that model median. The distribution has no finite upper bound.
If the log-scale mean stays fixed and sigma increases, does the arithmetic mean stay fixed?
Write a prediction (optional)
Seeded teaching simulation
Select Run Python below with the code unchanged.
A saved draft is open. To run the published example, open Tools and select Restore example. Recover draft brings your code back.
Execution error
Technical error details
Your result
Published example output
This result comes from the original Python. Your runs appear above. Build environment ↗
Sample median: 9.95 Model median: 10.0 Sample mean: 12.646 Model mean: 12.776 Minimum sampled value: 0.3864
Read the first result
Compare Sample median with Model median, then compare the two means. The model and sample have only positive values. That property alone cannot tell you whether a lognormal shape fits measured data.
Try an edit
Replace log_mean, log_sd = np.log(10), .7 with log_mean, log_sd = np.log(10), 1.2. Select Run Python again. Compare Model median and Model mean, then read Sample median and Sample mean. Which model summary stays fixed when the log-scale spread increases?
Scope. A lognormal has no finite upper bound. Hard physical bounds or different tail behaviour require a different model.
Try a fresh case
Someone gives a median of 20 and a log-scale SD of 0.4. Which mean parameter belongs in the lognormal generator?
Need a hint?
Hint 1
Write the model median as .
Hint 2
Invert that relationship to obtain log_mean.