Functions and default settings for PCA in R

There is a number of packages available in R that may be used for calculating principal components. Generally, there are two methods for classical PCA: Different packages are using these two functions but with different default settings for data pre-processing (namely: centering and scalling). One can also use simply prcomp and princomp functions. Following table shows most popular R packages used for this purpose

  • stats (princomp, prcomp)
  • FactoMineR (PCA)
  • ade4 (dudi.pca)
  • amap (acp)
  • PCAtools (pca) from Bioconductor
  • ca
  • MASS
  • ExPosition

Default settings for center and scale are presented in the next table.

FunctionCenterScaleRemarks
princompFALSEFALSEusing SVD
prcompTRUEFALSE
PCAFactoMineR
dudi.pcaade4
pcaPCAtools from Bioconductor

code fragment

Insert Image

Word Cloud: Company A

Krzysztof Banas
Krzysztof Banas
Principal Research Fellow

I work as beam-line scientist at Singapore Synchrotron Light Source. My research interests include application of advanced statistical methods for hyperspectral data processing (dimension reduction, clustering and identification).

Related