[R] error with princomp

Faheem Mitha faheem at email.unc.edu
Sun May 21 20:45:55 CEST 2000


Dear R people,

A followup on my previous message. I did a little more investigation and
experimentation. 

Firstly, I tried princomp, with cor = F. I was relieved that it gave me
the "covariance matrix is not non-negative definite" error, otherwise I
would have been really puzzled. So it seems clear that the first column of
my matrix being all ones is what is causing the if(symmetric) error.

Moving on, I was curious why Splus was not giving me a error for the same
reason. I looked at the covariance matrix, and guess what, I get (for
example)

             tanf2    
 tanf2  1.215290e-27

where R gave me zero. (tanf2 is the variable corresponding to the first
column). Clearly zero is the correct answer, so R is the voice of sanity
here. Three cheers for R!

So, I have decided that I will deleted that first column of ones and run
the results again. Goodness knows what terrible things this rounding error
may be doing later on in the calculation.

To close off, I would like to briefly explain what I am doing (which is
very simple) and ask if it seems reasonable. I don't want to be one of
those people out there doing nonsense statistics.

I have a data set, of 2061 rows and 99 columns originally. Now I guess it
is going to be 97 columns, since the first column was all zeros (even
Splus choked on this and I deleted it earlier) and the second one was all
ones. Anyway, the first 64 (was 66) columns are binary data. The last 33
are numeric data. Now, I thought that a reasonable thing to do (in fact,
the only thing I could think of) was to treat the first 64 columns as
numeric zeros and ones, and then use the cor=TRUE flag (ie use the
correlation matrix instead of the corelation matrix). This is advertised
as a way of handling cases when the data is not all of the same scale. So
that is what I did. Any comments/suggestions?
                                    Sincerely, Faheem Mitha.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list