SERVING THE QUANTITATIVE FINANCE COMMUNITY

yugmorf2
Topic Author
Posts: 87
Joined: November 21st, 2010, 5:18 pm

### Negative portfolio variance returned, despite having +ve definite correlation matrix

Hi,I'm perplexed as to what is going on here. Probably i've overlooked something obvious, but can't see where the error is. Please help.I have a vector of weights (9x1), a diagonal matrix of variances (9x9), a symetric positive definite matrix of correlations (9x9), and yet the portfolio variance (= w' x var x corr x var x w) comes out negative. The data is shown below. i calculate in excel that MDETERM(correl) = +0.000043, and portfolio variance = -4.227, which is clearly wrong. If my working turns out to be correct, and the problem is due to rounding error, i would appreciate any suggestions on how one might 'correct' for this, to arrive at a more agreeable result. Thank you!weights:-0.1580.2340.245-0.036-0.0950.0390.147-0.048-0.216variance8.6366 0 0 0 0 0 0 0 00 18.5005 0 0 0 0 0 0 00 0 8.75 0 0 0 0 0 00 0 0 11.25 0 0 0 0 00 0 0 0 14.6 0 0 0 00 0 0 0 0 12.4012 0 0 00 0 0 0 0 0 9.3508 0 00 0 0 0 0 0 0 11.0008 00 0 0 0 0 0 0 0 10.8256correlations1.000 0.290 0.811 0.422 0.849 0.688 0.788 0.810 0.8460.290 1.000 0.149 0.878 0.809 0.074 0.520 0.860 0.8950.811 0.149 1.000 0.707 0.806 0.898 0.677 0.714 0.7060.422 0.878 0.707 1.000 0.717 0.789 0.698 0.643 0.6350.849 0.809 0.806 0.717 1.000 0.797 0.784 0.761 0.6830.688 0.074 0.898 0.789 0.797 1.000 0.880 0.742 0.8000.788 0.520 0.677 0.698 0.784 0.880 1.000 0.823 0.8800.810 0.860 0.714 0.643 0.761 0.742 0.823 1.000 0.8230.846 0.895 0.706 0.635 0.683 0.800 0.880 0.823 1.000

ACD
Posts: 107
Joined: April 19th, 2004, 8:09 am

### Negative portfolio variance returned, despite having +ve definite correlation matrix

Just did an eigenvalue decomposition of that correlation matrix and there are two negative eigenvalues (which is why the determinant is positive). So it's not positive definite.> cormat [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 1.000 0.290 0.811 0.422 0.849 0.688 0.788 0.810 0.846 [2,] 0.290 1.000 0.149 0.878 0.809 0.074 0.520 0.860 0.895 [3,] 0.811 0.149 1.000 0.707 0.806 0.898 0.677 0.714 0.706 [4,] 0.422 0.878 0.707 1.000 0.717 0.789 0.698 0.643 0.635 [5,] 0.849 0.809 0.806 0.717 1.000 0.797 0.784 0.761 0.683 [6,] 0.688 0.074 0.898 0.789 0.797 1.000 0.880 0.742 0.800 [7,] 0.788 0.520 0.677 0.698 0.784 0.880 1.000 0.823 0.880 [8,] 0.810 0.860 0.714 0.643 0.761 0.742 0.823 1.000 0.823 [9,] 0.846 0.895 0.706 0.635 0.683 0.800 0.880 0.823 1.000> x = eigen(cormat)> x$values[1] 6.74320654 1.35231966 0.65745309 0.39153997 0.21323650 0.16917496[7] 0.03519892 -0.02793526 -0.53419439$vectors [,1] [,2] [,3] [,4] [,5] [,6] [1,] -0.3262321 0.26637108 -0.52088875 0.24342747 -0.01292045 0.17443435 [2,] -0.2684077 -0.72542964 -0.03531043 0.08774960 0.03496678 0.06576476 [3,] -0.3238844 0.39102608 0.18902907 0.32290173 0.47674186 0.08021464 [4,] -0.3172763 -0.22353982 0.67034822 0.00704243 0.08706782 0.08499213 [5,] -0.3551589 -0.04530851 0.01234721 0.59303402 -0.51707364 0.07720311 [6,] -0.3355516 0.39506772 0.32417515 -0.28887306 -0.08826192 -0.09974806 [7,] -0.3513467 0.08378137 -0.07043619 -0.47701763 -0.54800232 -0.10384052 [8,] -0.3540986 -0.13771881 -0.24309979 -0.02888058 0.30371109 -0.79201514 [9,] -0.3583317 -0.12573657 -0.27023806 -0.40646162 0.30991048 0.54553530 [,7] [,8] [,9] [1,] -0.40509033 0.51194078 0.18777981 [2,] 0.05543261 -0.07459123 0.61528694 [3,] -0.13083497 -0.56056538 0.19269526 [4,] -0.42441772 0.33995010 -0.29907930 [5,] 0.36796201 -0.10414185 -0.31686034 [6,] 0.50814715 0.33855162 0.39015237 [7,] -0.39139997 -0.41399337 0.03681418 [8,] 0.07787287 0.04712392 -0.26058179 [9,] 0.28759898 -0.05898537 -0.37108399>
Last edited by ACD on July 27th, 2011, 10:00 pm, edited 1 time in total.

yugmorf2
Topic Author
Posts: 87
Joined: November 21st, 2010, 5:18 pm

### Negative portfolio variance returned, despite having +ve definite correlation matrix

Thanks ACD. so excel 2010 MDETERM(correl matrix) gives a positive determinant. Does it mean that this is simply a wrong result (excel rounding error or something) or is it that a positive determinant is a necessary, but not sufficient, condition for positive definiteness? Must one alway calculate the eigenvalues to be sure?

mj
Posts: 3449
Joined: December 20th, 2001, 12:32 pm

### Negative portfolio variance returned, despite having +ve definite correlation matrix

a postive determinant does not imply positive definitenesseg-1 00 -1

yugmorf2
Topic Author
Posts: 87
Joined: November 21st, 2010, 5:18 pm

### Negative portfolio variance returned, despite having +ve definite correlation matrix

Clear now. thank you!

ACD
Posts: 107
Joined: April 19th, 2004, 8:09 am

### Negative portfolio variance returned, despite having +ve definite correlation matrix

QuoteOriginally posted by: yugmorf2Thanks ACD. so excel 2010 MDETERM(correl matrix) gives a positive determinant. Does it mean that this is simply a wrong result (excel rounding error or something) or is it that a positive determinant is a necessary, but not sufficient, condition for positive definiteness? Must one alway calculate the eigenvalues to be sure?It's necessary but not sufficient, the determinant can be shown to be the product of the eigenvalues, so if the number of negative eigenvalues is an even number and the rest are positive you'll get a positive determinant (as with MJ's example and your original matrix).

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...

 JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...

GZIP: On