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 μ\mu and SD σ\sigma. Its median is eμe^\mu and its mean is eμ+σ2/2e^{\mu+\sigma^2/2}. 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.

The parameters live on the log scale
01530456000.0210.0420.0630.084DensityPositive outcome
01530456000.0210.0420.0630.084DensityPositive outcome
median⁡(X)=eμ,E[X]=eμ+σ2/2\operatorname{median}(X)=e^\mu,\quad E[X]=e^{\mu+\sigma^2/2}
median⁡(X)=eμE[X]=eμ+σ2/2\begin{gathered}\operatorname{median}(X)=e^\mu\\E[X]=e^{\mu+\sigma^2/2}\end{gathered}
Reference illustration. Exact lognormal reference from the source: log mean log(10), log SD 0.7. The median is 10 and the mean is larger. The model is positive and unbounded; the graph shows only 0–60.

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.

Tools
About Python ↗

The code is editable. Press Ctrl+Enter or ⌘+Enter to run Python from the editor.

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?

Back to the Python editor

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?

Choose an answer
Need a hint?
Hint 1

Write the model median as eμlog⁡e^{\mu_{\log}}.

Hint 2

Invert that relationship to obtain log_mean.

Your notes