This is a wrapper for the pls::PCR
function for computing PCA.
pca(X, scale = FALSE, ncomp = 1, ...)
matrix
of input data.
logical
indicating if variables should be standardised (default=FALSE).
integer
number of principal components to return.
additional arguments to pls:pcr
.
multiblock
object with scores, loadings, mean X values and explained variances. Relevant plotting functions: multiblock_plots
and result functions: multiblock_results
.
PCA is a method for decomposing a matrix into subspace components with sample scores and variable loadings. It can be formulated in various ways, but the standard formulation uses singular value decomposition to create scores and loadings. PCA is guaranteed to be the optimal way of extracting orthogonal subspaces from a matrix with regard to the amount of explained variance per component.
Pearson, K. (1901) On lines and planes of closest fit to points in space. Philosophical Magazine, 2, 559–572.
Overviews of available methods, multiblock
, and methods organised by main structure: basic
, unsupervised
, asca
, supervised
and complex
.
Common functions for computation and extraction of results and plotting are found in multiblock_results
and multiblock_plots
, respectively.
data(potato)
X <- potato$Chemical
pca.pot <- pca(X, ncomp = 2)