How to get the vector "proportions of variance" from princomp in R

This should be very simple, and I hope someone can help me. I conducted an analysis of the main components with the following call:

pca <- princomp(....) summary(pca) 

The pca summary returns this description:

  PC1 PC2 PC3 Standard deviation 2.8788 2.7862 2.1845 Proportion of Variance 0.1977 0.1549 0.07831 

Look at the second line, which shows the variance explained by each PC. How can I programmatically extract this vector in my script from the pca variable. I have done enough searching and cannot find the answer.

+5
source share
1 answer

The proportion of variation is nothing more than normalized standard deviations. You can calculate them as PoV <- pca$sdev^2/sum(pca$sdev^2)

+4
source

Source: https://habr.com/ru/post/1215331/


All Articles