[R] princomp with not non-negative definite correlation matrix

Thomas Lumley tlumley at u.washington.edu
Mon Apr 14 15:50:44 CEST 2003

On Thu, 10 Apr 2003 tvr at stanford.edu wrote:

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

If you are confident the problem is due to rounding (or perhaps to small
amounts of missing data) you could set the smallest eigenvalue to zero.

However, in revising an introductory biostatistics text recently I have
found two correlation matrices with negative eigenvalues, both of which
were actually data entry errors.

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

More information about the R-help mailing list