[Rd] Re: [R] non-ideal behavior in princomp/ not a feature but a bug

Paul Gilbert pgilbert@bank-banque-canada.ca
Fri, 29 Sep 2000 09:37:47 -0400

>2. However, not all matrices work, such as the first one I tried yesterday.
>Here is
>an example of a matrix which does not work.
>> x
>     [,1] [,2] [,3] [,4]
>[1,] -0.4 -1.6 -1.0 -1.8
>[2,] -2.2 -0.3  1.4  0.2
>> princomp(x)
>Error in princomp(x) : covariance matrix is not non-negative definite

This does not happen with this example in Solaris, but I have had similar
problems with eigen before and had to use something like eigen( (cv + t(cv))/2 )
to avoid it. It seems to me that if eigen is called with symmetric = TRUE, as is
done in princomp, then eigen should return an error message about a
non-symmetric matrix, rather than return a possibly spurious answer from which
negative eigenvalues are checked to test for a non symmetric matrix.

Paul Gilbert

r-devel 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-devel-request@stat.math.ethz.ch