1
$\begingroup$

I have a large metabolomics dataset, 6000 samples and 3300 features. For the samples the only thing that differentiates each sample from the rest is that one gene was knocked out, which will not affect most of the metabolites. The features are metabolite concentrations.

There are some 'known'/measured batch and technical variables such as different Mass Spec runs, differential growth of the bacteria in the samples. However, I also want to adjust for the unknown variables.

It has been suggested that I perform PCA then throw out the first few principal components. However, I'm not sure how I can use the PCA information to predict values for the original features using the remaining principal components.

df.pca <- prcomp(as.matrix(df.rw),
             center = TRUE,
             scale. = TRUE) 

df.pca.x.minus12<-df.pca$x[,-c(1,2)]

How to predict values of the original 3300 features after removing the first 2 components?

$\endgroup$
11
  • $\begingroup$ The first (accepted) answer here stats.stackexchange.com/questions/57467 explains how to reconstruct original features in R using a small number of leading principal components. You need just a tiny modification: instead of using leading principal components, you use all except the leadings ones. $\endgroup$
    – amoeba
    Commented Sep 21, 2015 at 14:32
  • $\begingroup$ Thanks, I had actually read that answer earlier but still couldn't quite follow. Reading it a second time, its now more clear. $\endgroup$ Commented Sep 21, 2015 at 19:33
  • $\begingroup$ df.denoised <- df.pca$x[,3:3300] %*% t(df.pca$rotation[,3:3300]), but then you probably want to de-scale and de-center the reconstructed data, as explained in the linked question. $\endgroup$
    – amoeba
    Commented Sep 23, 2015 at 10:42
  • $\begingroup$ @amoeba I appreciate that the modification is in some sense "small" but in another sense it is asking quite the reverse. I think overall that this question benefits from having an answer in its own right, but certainly it is good for the new thread to be strongly linked to it. $\endgroup$
    – Silverfish
    Commented Aug 12, 2016 at 12:11
  • $\begingroup$ @Silverfish I tried to explicitly cover this situation in my new thread but perhaps I failed. Keeping the leading PCs and discarding the rest or discarding the leading PCs but keeping the rest is conceptually just exactly the same thing! Do you maybe think that I can make it more explicit in my new answer so that it could work as a duplicate? Any advises welcome. $\endgroup$
    – amoeba
    Commented Aug 12, 2016 at 12:14

1 Answer 1

1
$\begingroup$

Actually you might like to take a look into Surrogate Variable Analysis to determine unknown batch effects (link).

And also the author (J.Leek) is currently teaching a MOOC "Statistics for Genomic Data Science"

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.