Principle component analysis
0
1
Entering edit mode
10 months ago

while performing PCA to reduce the dimension of the variable using "Factomine R" package in R. I want to extract the each individual gene contribution towards principle component. using this function "var$contrib:" I extracted the file but I unable to set the cut off I mean upto which cutoff I have to select the genes. I am also attaching the code: library("FactoMineR") library("factoextra") data2 <- read.csv('t_data_processed_1_scale1.csv', header = TRUE) res.pca <- PCA(data2[,1:X]) print(res.pca) var <- get_pca_var(res.pca) var eig.val <- get_eigenvalue(res.pca) eig.val write.csv(eig.val,"feature_eigval_tissue.csv") fviz_contrib(res.pca, choice = "var", axes = 1, top = 10) featureCos2=var$cos2
write.csv(featureCos2,"featureCos2_tissue_new.csv")
featureContrib=var$contrib write.csv(featureContrib,"featureContrib_tissue_new.csv")  PCA cut-off • 416 views ADD COMMENT 0 Entering edit mode you can slice featureCos2 or featureContrib as a regular dataframe. Example: df[df$X>0.8,]
In the example above, you are selecting the rows of df that have a value greater than 0.8 in the column X.
Also try to format your question, using the code typography. Try to have each line of code in a different line, it makes it easier for the rest people to read and understand. Cheers!

0
Entering edit mode

Thank you very much for your reply. df\$X>0.8 It is mandatory or we can set the cut off 0.7 or 0.6 as well?

0
Entering edit mode

I have two datasets having having higher featurecontrib value in one dataset is .97 while in another dataset .47. how to set the cut off for each dataset.

0
Entering edit mode

You can set the cutoff you like, 0.8 was just a random number I used for the example. The cutoff you are applying is arbitrary so you decide which is the threshold you want to use.