# How to generate samples of Poisson-Lognormal distribution

I would like to compute samples of the number of product purchased in a supermarket. I want to model it with a mixed Poisson lognormal distribution.

1. Items purchased $$x$$ of a given consumer follow a Poisson distribution with the mean rate of purchasing $$\lambda$$

$$f(x)_{poisson}=e^{-\lambda}\lambda^{x}/x!$$

1. The mean rate of purchasing $$\lambda$$ of different consumers differ, and are distributed lognormally.

By combining 1 and 2, the probability density function of $$x$$ items purchased results the following distribution:

$$f(x)=\frac{1}{x!\sigma\sqrt{2\pi}}\int_{0}^{\infty}\lambda^{x-1} e^{-\lambda} e^{\frac{(log(\lambda-\mu)^2}{2\sigma^2} }\text{d}\lambda$$

I am simulating purchases in a supermarket, and I would like to sample this distribution to know the items purchased by each consumer by computing samples of this random variable, for example, with mean 2.32 and standard deviation 1.29 of products.

My simulator can generate easily samples of a Poisson and a Gaussian random variable. Is there any form to compute samples of the above mixed distribution using random samples of Poisson and Gaussian random variables?. I have seen in this post that lognormal and Gaussian distribution are related, but I do not know how to apply this to compute Poisson-lognormal random variable of items purchased.

## 1 Answer

You can generate a sample by first generating a normally distributed value, then take the exponent of that, then use that as the parameter in a Poisson distribution and take a sample from that distribution. The resulting samples of this three-step process will be Poisson-Lognormally distributed.

• thank you very much, I have to try this, seems simple process. – user1993416 Jan 14 '19 at 12:29