Session Ready
Exercise

PCA with ade4

Alright! Now that you've got some real hands-on experience with FactoMineR, let's have a look at ade4, a well-known and well-maintained R package with a large number of numerical methods for building and handling PCA models.

dudi.pca() is the main function that implements PCA for ade4 and by default, it is interactive: It lets the user insert the number of retained dimensions. For suppressing the interactive mode and inserting the number of axes within the dudi.pca() function, you need to set the scannf argument to FALSE and then use the nf argument for setting the number of axes to retain. So, let's put ade4 into practice and compare it with FactoMineR.

Instructions
100 XP
  • Run dudi.pca() on the numeric variables of cars with the ade4 package and, in a non-interactive mode, extract the first 4 principal components.
  • In the next two lines of code, you are asked to explore with summary() the resulting object cars_pca and pca_output_ten_v, the PCA model object that you built with FactoMineR earlier that is available in your workspace. Spend a few minutes in comparing the difference in the output of the two summaries.