I haven't found a function that directly calculates the matrix inverse, does it exist? Otherwise what would be the fastest way to do it? Patrik Waldmann -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Fri, 28 Apr 2000, Patrik Waldmann wrote:> I haven't found a function that directly calculates the matrix inverse, does it exist? Otherwise what would be the fastest way to do it? >Ainv<-solve(A) Note that if you want to solve Ax=b you can do solve(A,b), which should be quicker than solve(A)%*%b -thomas Thomas Lumley Assistant Professor, Biostatistics University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Finally, a question I can answer! solve(A) gives the inverse of A, I
believe. There is also the Moore-Penrose generalised inverse available as
ginv in the package MASS, but you probably don't need this. See pgs 55/56
of V&R 2nd edn. 3rd edn ?
Faheem.
On Fri, 28 Apr 2000, Patrik Waldmann wrote:
> I haven't found a function that directly calculates the matrix inverse,
does it exist? Otherwise what would be the fastest way to do it?
>
> Patrik Waldmann
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Patrik Waldmann wrote:> > I haven't found a function that directly calculates the matrix inverse, does it exist? Otherwise what would be the fastest way to do it? >You can use solve(), or if your matrix is not square, you can calculate the generalised inverse using the singular value decomposition function svd(). If you have a matrix X, svd(X) will return 1 vector d and 2 matrices u and v. The inverse of X is then the matrix calculated as v%*%diag(1/d)%*%t(u). If any element of vector d is 0, then replace the corresponding element in diag(1/d) by 0. Alberto __________________ Alberto G. Murta ______________________ IPIMAR - Institute of Fisheries and Sea Research Avenida de Brasilia; 1449-006 Lisboa; Portugal Tel:351 213027062; Fax:351 213015948; http://www.ipimar.pt -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._