Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: matrix inverse


From   [email protected] (William Gould, Stata)
To   [email protected]
Subject   Re: st: matrix inverse
Date   Tue, 16 May 2006 08:35:48 -0500

Vivian Sibbaluca <[email protected]> is having difficulty obtaining 
a generalized inverse:

> I do have a problem in generating matrix inverse in
> Stata, particularly generalized inverse. As far as I
> know, gen inverse always exists. When I tried to
> perform it in my matrix, which has a dimension of
> 960X960, the message was convergence not achieved. I
> tried it using another matrix of the same size, it was
> able to compute its inverse. The second matrix though
> is a full rank matrix. Then I tried using the inv
> command on the first matrix. Surprisingly, it was able
> to compute the inverse. I was wondering what seems to
> be the problem in the matginv command in Stata?

-matginv- is, I assume, Weesie's command?  I am not familiar with it.

Stata itself provides two functions, -syminv()- and -inv()-, and Mata provides
lots more.  Stata's -syminv()- is excellent for positive simidefinite
symmetric matrices when you wish to strike entire collinear rows and columns.
-inv()-, for nonsymmetric matrices, is adequate for some problems, but not
designed to tackle difficult ones.

If you need to find inverses of difficult nonsymmetric matrices, you need to
use Mata.  Stata of the art alternatives for -inv()- are there.  I especially 
recommend -qrinv()- and -pinv()-.

You probably will also want to look at Mata's solvers and eigenvalue routines.

In any case, type -help mata-, click on [M-4] Index and guide to functions, 
To headings on the page will be special interest:  heading matrix and heading 
solvers.

-- Bill
[email protected]
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index