Matrix inverse problem

For notifying us of what you believe are bugs or errors in EViews.
Please ensure your copy of EViews is up-to-date before posting.

Moderators: EViews Gareth, EViews Moderator

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Matrix inverse problem

Postby trubador » Fri Apr 08, 2016 6:50 am

I couldn't figure out why there is such a big difference in the results:

Code: Select all

importmat(name=xmat) C:\Users\...\Desktop\xmat.xlsx
matrix ymat = xmat*@inverse(@inner(xmat))*@transpose(xmat)

xopen(m)
xput xmat
xrun "zmat=xmat*inv(xmat'*xmat)*xmat';"
xget zmat

matrix difmat = ymat-zmat
scalar difsum = @sum(difmat)
show difsum
Attachments
xmat.xlsx
Data matrix
(74.28 KiB) Downloaded 86 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12339
Joined: Tue Sep 16, 2008 5:38 pm

Re: Matrix inverse problem

Postby EViews Gareth » Fri Apr 08, 2016 8:34 am

Not sure, but I just did it in R and R matches the EViews results (I think).
Follow us on Twitter @IHSEViews

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12339
Joined: Tue Sep 16, 2008 5:38 pm

Re: Matrix inverse problem

Postby EViews Gareth » Fri Apr 08, 2016 10:28 am

Further, since you're taking a projection matrix, the following should result in a matrix of approximately zero (I think):

Code: Select all

matrix test1 = xmat.@t*(@identity(467)-ymat)
matrix test2 = xmat.@t*(@identity(467)-zmat)
Follow us on Twitter @IHSEViews


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest