Get startedGet started for free

Calculating the proportion of variation explained

The proportion of variation and the cumulative proportion of variation explained by the leading PCs are widely used to determine the importance of the PCs and to decide the number of components to retain.

This exercise is part of the course

Multivariate Probability Distributions in R

View Course

Exercise instructions

  • Using the pca.state object that contains the PCs of the state.x77 data, calculate the variance explained by each principal component.
  • Calculate the proportion of variance explained by each principal component.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Variance explained by each PC
pca.var <- ___$sdev^2  

# Proportion of variance explained by each PC
pca.pvar <- pca.var/sum(___) 
Edit and Run Code