# PCA in R without deleting or imputing missing values

I want to perform a PCA on a dataset with missing values in R. the data set includes various variables (coralite area,diameter,distance between mouths ecc.)for different coral samples(250 samples and 11 variables).

I have some missing values in my data set but I would not want do imput values as some samples simply don't display some variables. it is not because those variables could not be measured, it is because some coral samples simply don't have those features (i.e. some coral samples don't show a coralite so the coralite area could not be measured). I would also not want to delete these observations because whilst these samples miss some observations they have others that would be relevant in the PCA analysis.

I could perform various PCA's including and exluding some variables so to have a complete dataset but I am afraid such action would lower the strength of my results.

• Possible duplicate of Omit NA and data imputation before doing PCA analysis using R
Jun 19 '19 at 15:15
• Are you simply trying to find principal components that capture the variability among the samples, or do you intend to use principal components as predictors for some type of regression or classification model?
– EdM
Jun 24 '19 at 18:08

At the end of the day, if you have missing values, you have missing values, and if you want to use a method that doesn't admit missing values, and you don't want to throw away valuable data, you're going to have to do some kind of imputation.

Imputation is not the end of the world, particularly if you can do it without introducing bias, and it's common practice in everyday science. For a relatively large sample, with relatively few missing values that are missing completely at random (i.e. they're not missing more in one type of coral than in another) then imputation is not that harmful.

There are many methods out there. You can try with a method that is multivariate and doesn't introduce too much bias, such as k-nearest neighbours (KNN).

It'd be a different situation if there were values that are missing because certain sample types don't have certain features. In that case you can get around the problem by redefining your variables to encode for that. But from your explanation, it doesn't look like this is the case, as you're saying your values are missing in certain samples, not certain sample types.

And doing KNN in R can be as simple as:

df = kNN(df)