vendredi 23 janvier 2015

Generating multidimensional normal random variables in matlab

the question is about the use of the covariance matrix in the multidimensional normal distribution:


I want to generate multi-dimensional random numbers x in matlab with a given mean mu and covariance matrix Sigma. Assuming Z is a standard normally distributed random number (eg. generated using randn() ), what is a correct code:



x = mu + chol(Sigma) * Z?


or



x = mu + Sigma^0.5 * Z ?


I am not sure about the use in the multidimensional normal distribution definition - whether the determinant in the denominator is of the square root of Sigma or the cholesky factor...


Looking forward to any hints. Thanks!





Aucun commentaire:

Enregistrer un commentaire