2
$\begingroup$

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.

Thank you in advance

$\endgroup$
2
  • $\begingroup$ Possible duplicate of Omit NA and data imputation before doing PCA analysis using R $\endgroup$
    – ahmad
    Commented Jun 19, 2019 at 15:15
  • $\begingroup$ 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? $\endgroup$
    – EdM
    Commented Jun 24, 2019 at 18:08

2 Answers 2

1
$\begingroup$

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)
$\endgroup$
0
$\begingroup$

@maia, brilliant case, imputing the values is indeed not adequate for your data. In contrast, what you'd need is to predict whether the corresponding coral feature is present or absent. Basically, you'd want to predict whether the value is missing or present.

From mathematical point of view you can't address this within a plain PCA (or plain SVD) framework. PCA framework is too "narrow" for your case. You'd need a framework that can bear and carry your data and has enough representative power -- you'd better treat your data as a mixture distribution. It is an adequate math framework for your case. BTW, in short, usual PCA/SVD is almost the same as GMM with the single component in the Gaussian mixture.

To approach mixture distribution model you may want first to take a look at Gaussian Mixture Models(GMM).

As of June 2022 the best estimator for GMM is still Mclust in R, e.g. it is still smarter than GMM-estimator from sklearn Python package.

The bad news is that none of those libraries are working with missing values like they should out-of-the-box ;-)

There is no ready-to-use implementation for distribution mixtures with missing values so far.

The world is still young.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.