```Date: Thu, 30 Jul 2009 14:04:22 -0400 Reply-To: msz03@albany.edu Sender: "SAS(r) Discussion" From: Mike Zdeb Subject: Re: matrix inverse without IML Content-Type: text/plain;charset=iso-8859-1 hi ... wow, a reference to a post from 2001 !!! well, since then, if you don't have IML, you can use some matrix functions PROC FCMP as was pointed out by a couple postings by Dale McLerran in a few postings, among them ... http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0812B&L=sas-l&P=R31866 http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0905A&L=sas-l&P=R24270 data x; input m1-m3; datalines; 1 3 3 1 4 3 1 3 4 ; run; proc fcmp; array temp[3,3] / nosymbols; array im[3,3]; rc = read_array('work.x',temp); call inv(temp, inverse); rc = write_array('work.y',im); quit; title 'matrix'; proc print data=x noobs; run; title 'inverse'; proc print data=y noobs; run; matrix m1 m2 m3 1 3 3 1 4 3 1 3 4 inverse im1 im2 im3 7 -3 -3 -1 1 0 -1 0 1 -- Mike Zdeb U@Albany School of Public Health One University Place Rensselaer, New York 12144-3456 P/518-402-6479 F/630-604-1475 > by understanding the operations behind a matrix inversion, we certainly can > resort to SVD algorithm > > SVD on a square matrix X is > X=UEV' > and once we got matrix U, E, V, we can obtain the inverse of X as > inv(X)=UE^{-1}V' > > since matrix E is an diagonal matrix, its inverse is simply inversion of > its diagonal scalar elements which can be easily done, taking numerical > stability into consideration. > > Well, I've also point out a way in SAS to do SVD (hence generalized > inverse) without IML (but you do need SAS/STAT) at > sas-programming.blogspot.com > > now you don't IML or other software and the overhead in exchange data > between them. > > On Thu, 7 Jun 2001 14:21:18 -0700, David L. Cassell > wrote: > >>Howard Schreier wrote [ in part]: >>>Here's an alternative. >>> >>> You probably have Excel. >>> >>> Excel has a function (MINVERSE) for inverting matrices. >>> >>> You could put the data into Excel, do the calculation, then get the data >>> back into SAS. >> >>Very clever [as usual]. But are you aware that Excel does *not* do a >>good job on some matrix and stat functions? I believe there is an ACM >>paper of last year in which two authors tested Excel on NIST test data >>sets for stats and it did wretchedly. I wouldn't use Excel to invert a >>matrix >>without substantial testing first. And if the matrix is ill-conditioned, >>Excel [or most non-matrix/stat software for that matter] may do a *ghastly* >>job of inverting the matrix properly. BTW, this is not just another MS >>slam, >>because I wouldn't trust any of the popular spreadsheets to do this well >>without >>testing first. >> >>OTOH, there are realtively inexpensive matrix mainpulation and stats >>packages >>which could be used in place of Excel here. GLIM comes to mind, as does >>Perl's PDL module [which is free - if you can get it to compile on your >>OS!] >>and the R system [also free]. >> >>David >>-- >>David Cassell, CSC >>Cassell.David@epa.gov >>Senior computing specialist >>mathematical statistician > ```

Back to: Top of message | Previous page | Main SAS-L page