Measurement, lognormal distribution, Monte-Carlo

1.1k Views Asked by At

I do have problems to understand the lognormal distribution.
So, I do have one measurement M, measured with a sensor having a std S.
As the sensor is not too accurate I want to build up a list of values which might also be true due to the std of the sensor.
As my measurement can't be negative I need a lognormal distribution.
As far as I understood it, I want a lognormal distribution with mean M and std S.
How do I reach that?
Taking samples via X(theta_i) = exp(M + S * theta_i); theta being a normal distributed random number (matlab 'rndn'), i = 1...10e6 doesn't give a distribution with mean M.

1

There are 1 best solutions below

0
On BEST ANSWER

Given $X \sim Log \mathcal N (\mu, \sigma^2)$ we have $\mathbb E[X]=e^{\mu+\sigma^2/2}$, meaning that the mean of such a variable is not $\mu$ (similarly with the variance). Refer to this wikipedia article for more information on the log-normal distribution.

If you want the standard deviation of $X$ to be $S$ and the mean to be $M$ (not the parameters of the distribution) then you have to solve for $\mu$ and $\sigma$ the following system of equations: $$ \begin{cases} M = \mathbb E[X] = e^{\mu+\sigma^2/2}, \\ S^2 = \mathbb V[X] = (e^{\sigma^2} - 1) e^{2\mu + \sigma^2}. \end{cases} $$

By noting that $e^{2\mu + \sigma^2} = (e^{\mu+\sigma^2/2})^2 = M^2$, we get from the second equation $(S/M)^2 = e^{\sigma^2} - 1$, which gives us

$$ \sigma = \sqrt{\ln{\left(\left(\frac{S}{M}\right)^2 + 1\right)}} $$

which is defined where the argument of the square root "makes sense". Placing $\sigma$ into the first equation we get

$$ e^\mu =M e^{-\sigma^2} = M e^{-\ln{\left(\left(\frac{S}{M}\right)^2 + 1\right)}} = M \frac{M^2}{S^2}. $$

Thus we get $\mu = \ln{M^3/S^2}$. Since $X=e^{\mu+\sigma Z}$ with $Z\sim \mathcal N(0,1)$, we can use the previously computed $\mu$ and $\sigma$ to simulate samples from a log-normal distribution with desired parameters.