[R] princomp with not non-negative definite correlation matrix
tvr@stanford.edu
tvr at stanford.edu
Fri Apr 11 06:09:15 CEST 2003
$ R --version
R 1.6.1 (2002-11-01).
So I would like to perform principal components analysis on a 16X16
correlation matrix, [princomp(cov.mat=x) where x is correlation matrix],
the problem is princomp complains that it is not non-negative definite.
I called eigen() on the correlation matrix and found that one of the
eigenvectors is close to zero & negative (-0.001832311). Is there any
way to work around this problem. A constraint: I only have the
correlation matrix, not the data that produced it.
I believe I could replicate most of the functionality of princomp
step-by-step (loadings, scores, etc.) and track the effect of the
negative eigenvector on the rest of the analysis, but I'd rather not do
that with every covariance/correlation matrix that might have a few
eigenvectors that are negative but close to zero.
(I've attached the matrix if anyone wants to replicate the error)
-------------- next part --------------
1.00 0.99 0.36 0.99 0.91 0.25 0.31 0.44 0.22 0.45 0.66 0.16 0.39 0.34 0.55 0.02
0.99 1.00 0.34 0.99 0.92 0.25 0.31 0.44 0.22 0.45 0.66 0.16 0.39 0.33 0.55 0.01
0.36 0.34 1.00 0.32 0.28 0.21 0.08 0.33 0.23 0.34 0.29 0.08 0.32 0.18 0.36 0.04
0.99 0.99 0.32 1.00 0.89 0.25 0.33 0.44 0.22 0.45 0.67 0.13 0.39 0.36 0.54 0.01
0.91 0.92 0.28 0.89 1.00 0.24 0.28 0.38 0.19 0.42 0.49 0.17 0.32 0.27 0.54 0.01
0.25 0.25 0.21 0.25 0.24 1.00 0.48 0.69 0.62 0.69 0.29 0.32 0.67 0.46 0.65 0.18
0.31 0.31 0.08 0.33 0.28 0.48 1.00 0.35 0.28 0.35 0.26 0.15 0.33 0.26 0.33 0.01
0.44 0.44 0.33 0.44 0.38 0.69 0.35 1.00 0.91 0.95 0.54 0.43 0.99 0.65 0.77 0.15
0.22 0.22 0.23 0.22 0.19 0.62 0.28 0.91 1.00 0.77 0.31 0.34 0.92 0.59 0.54 0.07
0.45 0.45 0.34 0.45 0.42 0.69 0.35 0.95 0.77 1.00 0.51 0.47 0.93 0.57 0.84 0.19
0.66 0.66 0.29 0.67 0.49 0.29 0.26 0.54 0.31 0.51 1.00 0.20 0.50 0.49 0.53 0.14
0.16 0.16 0.08 0.13 0.17 0.32 0.15 0.43 0.34 0.47 0.20 1.00 0.35 0.30 0.34 0.16
0.39 0.39 0.32 0.39 0.32 0.67 0.33 0.99 0.92 0.93 0.50 0.35 1.00 0.57 0.71 0.13
0.34 0.33 0.18 0.36 0.27 0.46 0.26 0.65 0.59 0.57 0.49 0.30 0.57 1.00 0.49 0.16
0.55 0.55 0.36 0.54 0.54 0.65 0.33 0.77 0.54 0.84 0.53 0.34 0.71 0.49 1.00 0.20
0.02 0.01 0.04 0.01 0.01 0.18 0.01 0.15 0.07 0.19 0.14 0.16 0.13 0.16 0.20 1.00
More information about the R-help
mailing list