On Aug 17, 2011, at 5:47 PM, David Winsemius wrote:


On Aug 17, 2011, at 5:19 PM, Rosario Garcia Gil wrote:

Hello

I am trying to run a PCA on the attached file, but I get this error message:

pc<-prcomp(data[,-(1:2)],scale=T)$x
Error in svd(x, nu = 0) : infinite or missing values in 'x'

What part of "missing values in 'x'" is unclear in that error message?

After looking further at the prcomp defaults I see that na.action defaults to na.omit so it may not be the missing data, but rather collinearity. Do these plotting and descriptive steps to see that your data is extremely clustered:

matplot(dat[,-(1:2)] )
 pairs(dat[-(1:2)])
summary(dat[-(1:2)])

So the effort to invert the data matrix is probably failing due to the application of inappropriate data reduction to variables which, though nominally numeric, are really categorical, and fairly strangely distributed ones at that. Also not this advice in ?prcomp:

"Note that scale = TRUE cannot be used if there are zero or constant (for center = TRUE) variables." I cpunt four variables that violate that restriction. But removing scale=T still does not fix the problem.

--

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to