On Wed, 26 Jul 2017, Sven Schreiber wrote:
Hi,
perhaps there's a bug in princomp in the case of reduced rank. See this
illustration:
<hansl>
matrix A = { 0, 0, 0, 0; \
0.0000 , 2.2790, -1.5619, -1.6955; \
0.0000 , -1.5619 , 1.2914 , 1.6958 ; \
0.0000 , -1.6955 , 1.6958 , 2.6103 }
eval mcov(A) # OK
eval mcorr(A) # OK (correct NAs)
matrix v = {}
eval eigensym(A, &v) # OK
print v
eval princomp(A, 1, 1) # try cov; only gives NAs
eval princomp(A, 1) # fails
</hansl>
In my understanding a PC is basically just an eigenvector of the covariance
(or correlation) matrix, so if eigensym(A) is able to calculate some
eigenvectors for the non-zero eigenvalues, so should be princomp(), no?
Not sure, I'll defer to Jack on that. But I note that R's princomp()
and prcomp() both choke on these data ("must be finite").
BTW, the error message for the last line is "syntax error",
which is also
wrong I think.
Looks like it, yes. That should be fixable.
Allin