Using Python, how can I sample data from a multivariate log-normal distribution? For instance, for a multivariate normal, there are two options. Let's assume we have a 3 x 3 covariance matrix and a 3-dimensional mean vector mu.
# Method 1
sample = np.random.multivariate_normal(mu, covariance)
# Method 2
L = np.linalg.cholesky(covariance)
sample = L.dot(np.random.randn(3)) + mu
I found numpy's numpy.random.lognormal, but that only seems to work for univariate samples. I also noticed scipy's scipy.stats.lognorm. This does seem to have the potential for multivariate samples. However, I can't figure out how to do this.
解决方案
A multivariate lognormal distributed random variable Rv should have this property: log(Rv) should follow a normal distribution. Therefore, the problem is really just to generation a rando