4
$\begingroup$

I want to programmatically draw a discrete random sample from a log-normal distribution. In order to do so, I calculate a $x$-value from uniform random source, e.g. some pseudo random number generator. This I use as input to the log-normal $PDF$ for a random variable $X \sim \ln\mathcal{N}(\mu, \sigma)$ with some parameters $\mu$ and $\sigma$. To get discrete values from this I round down the result, therefore I would have a new a random variable: $Y \sim \lfloor \ln\mathcal{N}(x;\mu,\sigma)\rfloor$

My question is now, how to calculate the probability that an observed result $y_0$ came from this distribution. My attempt is as follows:

In my understanding the floor function of the value has the effect of equaling the probabilities in an open interval $[y, y+1)$, therefore the probability could be calculated as $P(Y=y_0) = P(y_0 \le X < y_0+1) = P(X < y_0+1) - P(X < y_0)$.

As the log-normal distribution is continuous, $\forall y: P(X=y) = 0$. Therefore $P(X < y_0+1) - P(X < y_0) = P(X \leq y_0+1) - P(X \leq y_0)$. Hence, the probability of the observed value coming from the floor'ed variable $Y$ could be calculated as

$P(Y=y_0) = P(X \leq y_0 + 1) - P(X \leq y_0)$.

This could be easily done by using the log-normal $CDF$.

Am I looking at this the right way? Is this the correct solution?

$\endgroup$
  • 1
    $\begingroup$ This is correct. You can also use the Normal cdf since $X=\exp\{Z\}$, with $Z$ a Normal variate. $\endgroup$ – Xi'an Nov 26 '16 at 9:58
4
$\begingroup$

The OP has implicitly used a step-length equal to $1$ for the support of its discrete random variable. This in practice may be too large a step, especially if the standard deviation is small. More generally, and staying in the framework of non-negative random variables we can define the support of the discrete r.v. as

$$S_Y = \{0, h, 2h , 3h,...\}, h \in \mathbb Q_+$$

... where to keep things manageable, we designated a support equally spaced (although this is by no means necessary).

Since the OP rounds down the values he obtains, we have

$$\text {Prob}(Y = kh) = \text {Prob}(X < (k+1)h) - \text {Prob}(X < kh), \;\;k=0,1,...$$

and due to the continuity of $X$

$$\text {Prob}(Y = kh) = \text {Prob}(X \leq (k+1)h) - \text {Prob}(X \leq kh)$$

which in our case becomes

$$\text {Prob}(Y = kh) = \Phi\left(\frac {\ln [(k+1)h] - \mu}{\sigma}\right)-\Phi\left(\frac {\ln [kh] - \mu}{\sigma}\right)$$

where $\Phi()$ is the standard normal CDF.

Note that $k$ should not necessarily follow the Naturals one by one - we could have for example again an equally spaced support like $S_Y = \{0, 2h , 4h, 6h,...\} $ etc.

Looking at coding, the above formulation provides flexibility in exploring the structure of the support that best fits the needs.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.