mardi 9 novembre 2021

How to generate multivariate Normal distribution from a standard normal value?

I need to generate multivariate Normal distribution using only a generator of a random value and without scipy or numpy generators.

I need to generate the following enter image description here

This is my attempt

V = np.array([
    [1, 2], 
    [2, 5]])
B = np.linalg.cholesky(V)
A = np.array([1,2])

# norm() return one number from standard normal distribution 
n1 = np.array([norm() for _ in range(40)])
n2 = np.array([norm() for _ in range(40)])
np.array([n1,n2]).T.dot(B) + A

Here, I used Cholesky decomposition as in this post

However, I reckon this is not correct.




Aucun commentaire:

Enregistrer un commentaire