Matrix division operator in RATS

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.

Matrix division operator in RATS

Postby jonasdovern » Mon Jan 28, 2013 6:58 am

Is there a command in RATS that is equivalent to the matrix division command "\" in Matlab (e.g. A\B) for the case that A is an M-by-N matrix with N > or < M? (I reckon that for an N-by-N matrix A, %solve(A,B) will do the trick.)

From the Matlab expanation:
If A is an M-by-N matrix with M < or > N and B is a column vector with M components, or a matrix with several such columns, then X = A\B is the solution in the least squares sense to the under- or overdetermined system of equations A*X = B. The effective rank, K, of A is determined from the QR decomposition with pivoting. A solution X is computed which has at most K nonzero components per column. If K < N this will usually not be the same solution as PINV(A)*B. A\EYE(SIZE(A)) produces a generalized inverse of A.

Thanks a lot for any hint.
jonasdovern
 
Posts: 68
Joined: Sat Apr 11, 2009 10:30 am

Re: Matrix division operator in RATS

Postby TomDoan » Mon Jan 28, 2013 10:48 pm

It sounds like that would just be %GINV(A)*B
TomDoan
 
Posts: 2717
Joined: Wed Nov 01, 2006 5:36 pm

Re: Matrix division operator in RATS

Postby jonasdovern » Tue Jan 29, 2013 3:45 am

Thanks. This is working. Results are numerically identical to those obtained in Matlab.
jonasdovern
 
Posts: 68
Joined: Sat Apr 11, 2009 10:30 am


Return to Help With Programming

Who is online

Users browsing this forum: Google [Bot] and 1 guest