Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Mata finds nonreal although I can't find a no nonreal
From
Dirk Enzmann <[email protected]>
To
[email protected]
Subject
st: Mata finds nonreal although I can't find a no nonreal
Date
Tue, 27 Dec 2011 04:14:46 +0100
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: [email protected]
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/