# Re: st: matrix problems

 From "Austin Nichols" To statalist@hsphsun2.harvard.edu Subject Re: st: matrix problems Date Thu, 7 Feb 2008 21:23:00 -0500

```Dennis Coates <coates@umbc.edu>:
You seem to have a matrix of less than full rank, within the limits of
computer precision, i.e. no true inverse exists.  -help
matrix_functions- says:

inv(M)
Domain:       n x n nonsingular matrices
Range:        n x n matrices
Description:  returns the inverse of the matrix M.  If M is
singular, this will result in an error.

The function invsym() should be used in
preference to inv() because invsym() is more accurate.  The row
names of the result are obtained from the column
names of M, and the column names of the results are
obtained from the row names of M.

invsym(M)
Domain:       n x n symmetric matrices
Range:        n x n symmetric matrices
Description:  returns the inverse of the M if M is positive
definite.  If M is not positive definite, rows will be
inverted until the diagonal terms are zero or
negative; the rows and columns corresponding to these
terms will be set to 0, producing a g2
inverse.  The row names of the result are obtained from the
column names of M, and the column names of
the result are obtained from the row names of M.

On Feb 7, 2008 10:32 AM, Dennis Coates <coates@umbc.edu> wrote:
> Hi statalisters,
>
> I am trying to program the Chernozhukov-Hansen Wald statistics for
> robust inference with weak instruments with overidentification.

> matrix see = (1/rowsof(Z))*Z'*epsilon*epsilon'*Z
> matrix seeinv = inv(see)

> . matrix list see
>
> symmetric see[3,3]
>                   c1       c2  c3
>    r1      195.5102
>    r2     27.943648     3.9938963
>    r3    -67.939952      -9.71044     23.609187
>
> . matrix list seeinv
>
> symmetric seeinv[3,3]
>                   c1   c2   c3
>     r1     .00511482
>     r2             0             0
>     r3             0             0             0
>
> Obviously, the product of see and seeinv does not produce an identity
> matrix.  Using syminv to create the inverse matrix did not resolve matters.
*
*   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/
```