Re: mvnrnd and positive semidefinite covariance matrices



In article <ef2c0c9.-1@xxxxxxxxxxxxxxxx>, "Frank Wu"
<frank.z.wu@xxxxxxxxx> wrote:

Hi. Newbie question here.

Does anyone know why Matlab's mvnrnd function requires that the
covariance matrix be positive semidefinite? Is it possible to
generate random numbers from a multivariate normal distribution whose
covariance matrix is not positive semidefinite?

As context: I'm currently using the mvnrnd function to generate
random portfolio returns based off of random asset class
performances. Because the covariance matrix of the asset classes is
not positive semidefinite, I've had to use a conversion, which leads
to the portfolio not quite having the distribution that I expected.

Thanks!
----------------
By the very definition of covariance, the covariance matrix for any set
of real random variables must always be positive semidefinite! This can
be demonstrated as follows.

Let x1, x2, ..., xn be any set of real-valued random variables and
define y1 = x1-mean(x1), y2 = x2-mean(x2), ..., yn = xn-mean(xn). Let y
be the n x 1 vector [y1;y2;...;yn]. Let t be any real n x 1 vector. Then
the real scalar quantity (t'*y)^2 must always be non-negative, so its
expected value is also non-negative:

E{(t'*y)^2} = E{(t'*y)*(y'*t)} = E{t'*(y*y')*t} = t'*E{y*y'}*t >= 0

The quantity E{y*y'} is by definition the covariance matrix of the random
variables, x1, x2, ..., xn, and the fact that the above inequality holds
for all t is the condition for positive semidefiniteness of the matrix.

In particular, the covariance matrix for 'mvnrnd' must be positive
semidefinite, as well as that for any other kinds of random variables, no
matter what their joint distribution, including presumably your "random
asset classes". (Note that the phrase "semi" is essential here to allow
for random variables which might be totally correlated in some way.)

(Remove "xyzzy" and ".invalid" to send me email.)
Roger Stafford
.



Relevant Pages

  • Re: Q: properties of covariance matrices
    ... >Let x and y be n-tuplets of normally distributed random variables, ... > C = covbe the nxn covariance matrix of x and y. ... every positive semidefinite matrix is the covariance matrix of some ...
    (sci.physics)
  • Re: Q: properties of covariance matrices
    ... >Let x and y be n-tuplets of normally distributed random variables, ... > C = covbe the nxn covariance matrix of x and y. ... every positive semidefinite matrix is the covariance matrix of some ...
    (sci.math)
  • mvnrnd and positive semidefinite covariance matrices
    ... Does anyone know why Matlab's mvnrnd function requires that the ... generate random numbers from a multivariate normal distribution whose ... covariance matrix is not positive semidefinite? ...
    (comp.soft-sys.matlab)
  • Re: mvnrnd and positive semidefinite covariance matrices
    ... Does anyone know why Matlab's mvnrnd function requires that the ... covariance matrix is not positive semidefinite? ... It's also sometimes possible have a true cov matrix that is nearly singular, but end up with an estimate that has eigenvalues that are slightly negative due to small numerical errors -- that's an easy fix. ...
    (comp.soft-sys.matlab)
  • Re: mvnrnd and positive semidefinite covariance matrices
    ... Does anyone know why Matlab's mvnrnd function requires that the ... generate random numbers from a multivariate normal distribution whose ... covariance matrix is not positive semidefinite? ...
    (comp.soft-sys.matlab)

Loading