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.
Near Singular Matrix
Moderators: EViews Gareth, EViews Steve, EViews Jason, EViews Moderator, EViews Pamela

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11119
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Near Singular Matrix
Assuming this is the matrix you emailed into us, the determinant is not just "very small", it is essentially zero. 1.05e101 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).
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).
Follow us on Twitter @IHSEViews
Re: Near Singular Matrix
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!
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!

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11119
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Near Singular Matrix
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)?
Follow us on Twitter @IHSEViews

 Nonnormality and collinearity are NOT problems!
 Posts: 3073
 Joined: Wed Sep 17, 2008 2:25 pm
Re: Near Singular Matrix
If you post an EViews workfile with the matrix, I'll try inverting it in Matlab to see what happens.

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11119
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Near Singular Matrix
I believe the matrix in question is the one called "phi" in the attached workfile.
 Attachments

 phi.WF1
 phi matrix
 (8.85 KiB) Downloaded 189 times
Follow us on Twitter @IHSEViews

 Nonnormality and collinearity are NOT problems!
 Posts: 3073
 Joined: Wed Sep 17, 2008 2:25 pm
Re: Near Singular Matrix
Matlab gives a warning message before inverting
Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 9.842126e018.
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
Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 9.842126e018.
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
Who is online
Users browsing this forum: No registered users and 1 guest