GARETH GRANTTECHNOLOGY · DATA · INNOVATION
Explore

13 / Distributions

Lognormal distribution: positive, right-skewed values

A lognormal model is useful when the logarithm of a positive measurement is approximately normal. Its mean, median and upper percentiles can differ substantially, making it relevant to budgets and tail exposure.

IntermediateLive exploration + Python

The business question

How should we plan for positive costs or durations with occasional large outcomes?

  • Explore repair costs or completion durations that are positive and right-skewed.
  • Distinguish a typical case from the expected cost relevant to an aggregate budget.
  • Estimate upper cost or time thresholds while avoiding negative values implied by some symmetric models.

How the method works

Take natural logarithms of strictly positive measurements and inspect whether their transformed distribution is approximately normal in a stable operating regime. The log scale describes proportional rather than equal-sized changes. It is a candidate model when many multiplicative influences contribute to a value; the presence of skewness alone does not establish that the lognormal form fits.

The parameters μ and σ describe the mean and standard deviation of ln(X), not the arithmetic mean and standard deviation of X. The median on the original scale is exp(μ), while the mean is exp(μ + σ²/2). The difference grows with log-scale variation. A manager budgeting expected total cost generally needs the mean, whereas the median can describe the middle observed case.

Calculate a percentile by transforming a normal percentile back to the original units: exp(μ + σz_q). This provides a threshold for one modelled case. The percentile of the total cost of many jobs cannot be obtained by simply multiplying individual 95th percentiles. Aggregate risk depends on dependence, job counts and shared shocks, so a separate model or simulation is needed for a total-budget coverage decision.

The calculation

ln(X) ~ Normal(μ,σ²); median(X) = exp(μ); E[X] = exp(μ+σ²/2); q-th percentile = exp(μ+σz_q)
Read the symbols
SymbolMeaning
XA strictly positive value measured in a consistent unit.
μ, σMean and positive standard deviation of the natural-log values.
z_qStandard normal percentile at cumulative probability q.
expExponentiation with base e; the inverse of the natural logarithm.

A worked business example

ILLUSTRATIVE SCENARIO

Illustrative repair company models per-job material costs with a lognormal scenario. The median is R1,000 and the standard deviation of the natural-log costs is 0.60.

Inputs

  • μ = ln(1,000); σ = 0.60 on the log scale.
  • High-cost threshold = R2,000.
  • Single-job percentile of interest = 95%.

Work through the numbers

  1. The median is exp(ln(1,000)) = R1,000.
  2. Calculate the mean: exp(ln(1,000) + 0.60²/2) = 1,000 × exp(0.18) = R1,197.22.
  3. Use z_0.95 = 1.6448536: the 95th percentile is 1,000 × exp(0.60 × 1.6448536) = R2,682.94.
  4. The standardised log threshold for R2,000 is ln(2,000/1,000)/0.60 = 1.1552453. Its upper-tail probability is 12.3995%.
Median R1,000; expected single-job cost R1,197.22; 95th percentile R2,682.94; probability above R2,000 about 12.40%.

Using the median as the expected cost would understate this model’s average material requirement. The upper percentile helps frame contingency discussions, but it does not determine a whole-month budget by itself.

Explore the decision

Model positive, right-skewed quantities. The live explorer has its own example inputs; it is separate from the worked calculation above.

Enable JavaScript to use this calculator. The worked example and executable Python remain available.

Apply it at work

  1. Define the positive outcome, measurement unit and stable product or job population.
  2. Inspect raw and log-transformed values, with attention to zeros, mixtures and changes over time.
  3. Estimate log-scale parameters and report the mean, median and relevant tail probability separately.
  4. Validate on later jobs and model counts and dependence before translating individual risk into an aggregate budget.

Check these assumptions

  • Values are strictly positive; a genuine zero outcome needs a separate treatment or mixture model.
  • Natural-log values are approximately normal within the modelled regime.
  • Costs use a consistent currency basis, including any relevant inflation or price-period adjustment.
  • The example treats the parameters as known and does not quantify their estimation uncertainty.

Common mistakes and how to avoid them

  • Supplying an arithmetic standard deviation as SciPy’s lognormal shape parameter produces the wrong model.
  • Adding a constant to handle zeros changes the interpretation and requires justification.
  • A few very large valid costs can drive the fitted mean; investigate them and test sensitivity rather than removing them automatically.

How this can help the business

  • Budgeting can distinguish expected resource consumption from a customer’s typical job.
  • Managers can compare contingency thresholds explicitly and see how variation, rather than only average cost, changes exposure.
A decision rule to adapt

Use the lognormal model when positive data and log-scale diagnostics support it; choose budget protection using the appropriate aggregate-risk model.

When to use another approach

Use gamma, Weibull, an empirical distribution or a mixture model when the lognormal shape or zero-value treatment does not match the process.

Reproduce the worked example in Python

The code is self-contained for this example. Dependencies and run instructions are included with the downloadable notebook.

Show executable code and recorded output
from math import log, exp
from scipy.stats import lognorm
mu, sigma = log(1000), 0.60
scale = exp(mu)
print(f'Median cost: R {scale:.2f}')
print(f'Mean cost: R {lognorm.mean(sigma,scale=scale):.2f}')
print(f'95th percentile: R {lognorm.ppf(0.95,sigma,scale=scale):.2f}')
print(f'Cost above R2000: {lognorm.sf(2000,sigma,scale=scale):.2%}')

Recorded output

Median cost: R 1000.00
Mean cost: R 1197.22
95th percentile: R 2682.94
Cost above R2000: 12.40%
Download all worked examples

Sources and further reading

Concepts are linked to primary teaching or technical sources. The business examples are illustrative applications, not reported client results.