The lognormal distribution is a commonly used distribution for modelling asymmetric data. It’s just the log of a Normal distribution right? Well no, it’s actually the other way around. You take the log of a lognormal distribution to arrive at a normal distribution. Is it just me, but I always have a bit of a mental block about this, it always feels a bit back to front.
In this post I will explore the relationship between a lognormal distribution and a normal distribution.
Generating Distribution Data
JMP has a collection of functions for generating random data sampled from a specific distribution:
So it’s easy for me to generate data for both a normal and lognormal distribution, and to compare them:
Now that I can look at the lognormal distribution let me take a closer look at its parameters. To generate random data from a lognormal distribution I use the following function:
Here is the distribution using mu=4.6 and sigma=0.35:
What I find confusing is that sigma is not the standard deviation of the data and mu is not the mean. Presumably then, they relate to the parameters of the associated normal distribution. Let’s see. I can create a new variable Z which is the log transform of the data:
Hey presto – the mean and standard deviation match the parameters I used for the Random Lognormal function.
But What If . . .
I want to generate a lognormal distribution with the same mean and standard deviation as the above data.
The calculation is more complex than you might expect. If and s represent the mean and standard deviation of the normal distribution then the parameters for the lognormal distribution are given by:
Applying these equations to the above data yields values of -0.005 and 0.1 respectively.
Finally, I can verify these numbers by using them with the Random Lognormal function to generate some sample data. If I have the correct parameters then the data will have a mean of 1.0 and a standard deviation of 0.1: