2

I have a character matrix for some different plant species, in which most species are missing data for at least a few characters. I want to do a principal components analysis, so I tried to impute the missing values, but when I try to do that I get the error message:

Error in eigen(crossprod(X, X), symmetric = TRUE) : infinite or missing values in 'x'

I thought having missing values was kind of the point! Does anyone know what I'm doing wrong?

Joe
  • 6,965
  • 1
  • 43
  • 53
  • How did you impute te missing values? Also provide sample data using `dput(your data)` and sample code. – NelsonGon Dec 13 '18 at 03:43
  • When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. But I don't think PCA can be performed with missing data. You'd have to do the decomposition with complete cases only. – MrFlick Dec 13 '18 at 05:46
  • See this question for useful information on imputation. https://stackoverflow.com/questions/39862778/imputation-with-column-medians-in-r – Joe Dec 13 '18 at 13:34

1 Answers1

1

You should use the function imputePCA available in the package missMDA.

For more information: http://factominer.free.fr/missMDA/index.html

Best

Francois

Husson
  • 66
  • 2