Solved – How to calculate a mean and standard deviation for a lognormal distribution using 2 percentiles

lognormal distributionr

I am trying to calculate a mean and standard deviation from 2 percentiles for a lognormal distribution.

I was successful in performing the calculation for a normal distribution using X = mean + sd * Z and solving for mean and sd.

I think I am missing an equation when I try to do the same thing for a lognormal distribution. I looked at wikipedia and trying to use ln(X) = mean + sd * Z but I'm getting confused whether the mean and sd in this case are for the normal distribution or the lognormal.

Which equations should I be using? and will I need more than 2 percentile to solve the calculations?

Best Answer

It seems that you "know" or otherwise assume that you have two quantiles; say you have that 42 and 666 are the 10% and 90% points for a lognormal.

The key is that almost everything is easier to do and understand on the logged (normal) scale; exponentiate as little and as late as possible.

I take as examples quantiles that are symmetrically placed on the cumulative probability scale. Then the mean on the log scale is halfway between them and the standard deviation (sd) on the log scale can be estimated using the normal quantile function.

I used Mata from Stata for these sample calculations. The backslash \ joins elements column-wise.

mean = mean(ln((42 \ 666)))

(ln(666) - mean) / invnormal(0.9)
1.078232092

SD = (ln(666) - mean) / invnormal(0.9)

The mean on the exponentiated scale is then

exp(mean + SD^2/2)
299.0981759

and the variance is left as an exercise.

(Aside: It should be as easy or easier in any other decent software. invnormal() is just qnorm() in R if I recall correctly.)