IniziaInizia gratis

Choosing the number of PCs

One of the main challenges with PCA is selecting the number of PCs, which can be done by determining the amount of the cumulative proportion of variance that is explained. We will use this method to select the number of PCs needed to explain 95% of the variation in the state.x77 data. The proportion of variation explained by each PC is preloaded for you as the object pca.pvar.

Questo esercizio fa parte del corso

Multivariate Probability Distributions in R

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Proportion of variance explained by each principal component


# Cumulative variance explained plot
plot(___, xlab = "Principal component", ylab = "Cumulative Proportion of variance explained", ylim = c(0,1), type = 'b')
grid()
Modifica ed esegui il codice