I'm hoping to understand why two draws from a multinormal distribution, with the same but reordered mean vector (and correctly reordered covariance vector) differ when the covariance is exponential.
This MWE should explain better than that:
import numpy as np
np.random.seed(10)
x0 = [1,2,3]
y0 = np.diag([0.3, 0.5, 0.7])
z0 = np.random.multivariate_normal(x0, y0)
np.random.seed(10)
x1 = [3,2,1]
y1 = np.diag([0.7, 0.5, 0.3])
z1 = np.random.multivariate_normal(x1, y1)
print (np.allclose(z0, np.flip(z1))) # True, as expeceted
np.random.seed(10)
z0 = np.random.multivariate_normal(x0, np.exp(y0))
np.random.seed(10)
z1 = np.random.multivariate_normal(x1, np.exp(y1))
# these are unexpectedly different
print (z0, z1)
print (z0.mean(), z1.mean())
Is that difference mathematical, or numeric, or something else entirely?
Aucun commentaire:
Enregistrer un commentaire