Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Dirk Enzmann <dirk.enzmann@uni-hamburg.de> |

To |
statalist-digest@hsphsun2.harvard.edu |

Subject |
st: Mata problem with nonreals [was: Re: Mata finds nonreal although I can't find a no nonreal] |

Date |
Tue, 27 Dec 2011 13:51:24 +0100 |

"Mata rinds nonreal although I can't find a nonreal", even better: "Why does Mata report nonreals?"

A1 = S1*(V1:/sqrt(eigv1))*V1' the command line A1 = sign(P1):*abs(A1)

Thus, a suggestion on how to solve the problem is highly appreciated. Dirk Am 27.12.2011 04:14, schrieb Dirk Enzmann:

I just encountered the problem that Mata gives me the error message invsym(): 3253 nonreal found where real required <istmt>: - function returned error although I believe that there is no nonreal value in the matrix. Below is the code that produces the error in the line W1 = A1*invsym(A1'*A1) Note that P1, S1, and A1 should contain the same values due to the fact that RF1 is an identity matrix - if I replace A1 by P1 Mata behaves as it should. If you ask why I use RF1 like that: I am testing whether the special case of a zero correlation is handled correctly - if I insert values such as .05 in the off-diagonal cells, Mata keeps complaining about nonreal values. Any suggestions for a solution of this problem? * -------- (start) ---------- mata P1 = ( .43506, .44920 \ .68702, .06891 \ .77649, -.09335 \ -.60949, .27331 \ .02898, .65232 \ -.16600, .43717 \ .82794, -.04080 \ .79320, -.11331 \ -.04388, .62171 \ .03556, .71095 \ .08361, .75362 \ -.23253, .58472 \ .71299, -.20058 \ -.19725, .55294 \ .51660, .03276 ) RF1 = ( 1.00, .00 \ .00, 1.00 ) S1 = P1*RF1 S1 V1 = NULL eigv1 = NULL eigensystem(RF1,V1,eigv1) A1 = S1*(V1:/sqrt(eigv1))*V1' A1 rssqA1 = diagonal(A1*A1') rssqA1 cssqA1 = diagonal(A1'*A1) cssqA1 W1 = A1*invsym(A1'*A1) W1 end * -------- (end) ------------ Dirk ======================================== Dr. Dirk Enzmann Institute of Criminal Sciences Dept. of Criminology Rothenbaumchaussee 33 D-20148 Hamburg Germany phone: +49-(0)40-42838.7498 (office) +49-(0)40-42838.4591 (Mrs Billon) fax: +49-(0)40-42838.2344 email: dirk.enzmann@uni-hamburg.de http://www2.jura.uni-hamburg.de/instkrim/kriminologie/Mitarbeiter/Enzmann/Enzmann.html ========================================

-- ======================================== Dr. Dirk Enzmann Institute of Criminal Sciences Dept. of Criminology Rothenbaumchaussee 33 D-20148 Hamburg Germany phone: +49-(0)40-42838.7498 (office) +49-(0)40-42838.4591 (Mrs Billon) fax: +49-(0)40-42838.2344 email: dirk.enzmann@uni-hamburg.de http://www2.jura.uni-hamburg.de/instkrim/kriminologie/Mitarbeiter/Enzmann/Enzmann.html ======================================== * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**st: Re: Mata problem with nonreals [was: Re: Mata finds nonreal although I can't find a no nonreal]***From:*Dirk Enzmann <dirk.enzmann@uni-hamburg.de>

**Re: st: Mata problem with nonreals [was: Re: Mata finds nonreal although I can't find a no nonreal]***From:*Matthew Baker <matthew.baker@hunter.cuny.edu>

**References**:**st: Mata finds nonreal although I can't find a no nonreal***From:*Dirk Enzmann <dirk.enzmann@uni-hamburg.de>

- Prev by Date:
**st: computing preference choices** - Next by Date:
**Re: st: Mata problem with nonreals [was: Re: Mata finds nonreal although I can't find a no nonreal]** - Previous by thread:
**st: Mata finds nonreal although I can't find a no nonreal** - Next by thread:
**Re: st: Mata problem with nonreals [was: Re: Mata finds nonreal although I can't find a no nonreal]** - Index(es):