Page 1 of 1

### Near Singular Matrix

Posted: Thu Sep 10, 2009 2:37 pm
Hi,

As a part of some complex calculation I am simply trying to invert a matrix in e views. However everytime i get the error 'Near Singular matrix...'

The determinant agreed is very small, however i dont need the inverted matrix (with large elements), rather its being invereted as a part of some transient calculation the end result of which should finally make sense. The inversion works fine in Excel as well as Stata. I want to automate the whole process and hence want to do it in E Views. Can anyone help me with resolving this error. Thank u so much.

### Re: Near Singular Matrix

Posted: Thu Sep 10, 2009 3:15 pm
Assuming this is the matrix you emailed into us, the determinant is not just "very small", it is essentially zero. 1.05e-101 is not "very small". it is zero.

Yes other packages may invert the matrix, but the result they give is a matrix full of extremely large numbers. This matrix is unworkable, and will disrupt any further analysis you do using it. The fact that it is only "part of some transient calculation" is irrelevant - were you to use the result from Excel or Stata all of the calculations based upon the inverse would be meaningless.

I think you're approaching this problem in the wrong way. Rather than trying to get EViews to invert a singular matrix for you, you might be better off working out what is making it singular in the first place (which is essentially an econometric/economic problem, not a software problem).

### Re: Near Singular Matrix

Posted: Fri Sep 11, 2009 2:44 pm
The equation that i am using to invert the Matrix is Expected Return of a Black Litteman Model (where the matrix being inverted is the Covariance Matrix, Sigma). If you assume 1.55 x 10 ^ (-101) as zero then the final form the equatiom takes is 0/0 (where both numbers are not zero but tending to zero). Therefore the final result which if at all successfully calculated makes a lot sense (i requested my fellow group to test it on Stata).

In general i am a fan of EViews but i know every software has its limitation and there is nothing wrong with that, but to simply term something as not possible , I would hesitate in that!

### Re: Near Singular Matrix

Posted: Fri Sep 11, 2009 2:56 pm
If you invert the matrix in Excel, and then invert it in Stata, do you get the same result? If you invert it in Stata, then multiply it by five and invert, do you get the same result (but divided by 5)?

### Re: Near Singular Matrix

Posted: Fri Sep 11, 2009 3:26 pm
If you post an EViews workfile with the matrix, I'll try inverting it in Matlab to see what happens.

### Re: Near Singular Matrix

Posted: Fri Sep 11, 2009 3:41 pm
I believe the matrix in question is the one called "phi" in the attached workfile.

### Re: Near Singular Matrix

Posted: Fri Sep 11, 2009 3:57 pm
Matlab gives a warning message before inverting

Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 9.842126e-018.

When I multiply the inverse in Matlab by the original matrix, I get a matrix that looks like an identity matrix with a lot of roundoff error. Here is the upper 3x3 block

0.974243 0.003296 0.022705
-0.011719 1.054688 0.039063
0.046875 -0.007813 1.031250