In probability theory, a log-normal (or lognormal) distribution is a continuous probability distribution of a random variable whose logarithm is normally distributed. Thus, if the random variable X {X} X is log-normally distributed, then Y = ln a ( X ) {Y=(X)} Y=(X) has a normal distribution. Likewise, if Y {Y} Y has a normal distribution, then X = exp a ( Y ) {X=(Y)} X=(Y) has a log-normal distribution.
Here we peform two steps:
In this exercise, we have empirically proved that the logarithmic transform of a random number series generated by Log-Normal Distribution converges to a Normal Distribution.
set.seed(3327)
mean <- 0.10 # the mean parameter
stdev <- 0.05 # std dev
n <- 50 # number of exponentials
sim <- 10000 # 10K simulations
# the log normal distribution
plot(rlnorm(10000,mean, stdev), pch=20, cex=0.6, main="The Log-Normal Distribution w/ Mean of 0.10, Std dev of 0.05, and 10.000 Observations")
Generate a Simulation, then transform by applying the logarithm:
logT <- NULL
for (i in 1 : sim) logT <- c(logT, log(rlnorm(n,mean,stdev)))
hist(logT, col="blue", main="Log-Normal Log Transformation", breaks=64)
rug(logT)
Generate a random normal distribution with the same parameters:
rNorm <- NULL
for (i in 1 : sim) rNorm <- c(rNorm, rnorm(n,mean,stdev))
hist(rNorm, col="red", main="Normal Distribution", breaks=64)
rug(rNorm)
Visual
hist(logT, prob=TRUE, col="lightblue", main="Density + Curve Fit", breaks=64)
lines(density(rNorm), lwd=3, col="red")
legend( "topright", c("Log-Normal Simulation", "Normal Curve Fit"), lty = 1, col=c("lightblue", "red"))
Quantiles comparison
# Log Normal Quantiles
quantile(logT, probs=c(0.05, 0.10, 0.25, 0.50, 0.75, 0.90, 0.95), na.rm = FALSE)
## 5% 10% 25% 50% 75% 90%
## 0.01793370 0.03611395 0.06629816 0.10001132 0.13368916 0.16418413
## 95%
## 0.18220535
# Normal Quantiles
quantile(rNorm, probs=c(0.05, 0.10, 0.25, 0.50, 0.75, 0.90, 0.95), na.rm = FALSE)
## 5% 10% 25% 50% 75% 90%
## 0.01797701 0.03607953 0.06618258 0.09981174 0.13355949 0.16391766
## 95%
## 0.18212207
As we can observe from the results, the logarithmic transform of a random number series generated by Log-Normal Distribution does converge almost perfectly to a Normal Distribution.