This function is used to perform Principal Component Analysis (PCA).

pca(X, pc = 2, scale = "UV", center = TRUE, method = "nipals")

Arguments

X

Numeric input matrix with each row representing an observation and each column a metabolic variable.

pc

Desired number of principal components.

scale

Desired scaling method: None, UV (unit variance) or Pareto (Pareto scaling). #' @param center Logical indicating if data should be mean centered.

method

Algorithm for computing PCA. NIPALS is default and usually fine, see Details for other methods.

Value

This function returns a PCA_metabom8 S4 object.

Details

Other PCA algorithms build on the pcaMethods R package and include: 'svd', 'ppca', 'svdImpute', 'robustPca', 'nlpca'. For complete list of available methods see ?pcaMethods::pca documentation.

References

Geladi, P and Kowalski, B.R. (1986), Partial least squares and regression: a tutorial. Analytica Chimica Acta, 185, 1-17.

See also

Author

Torben Kimhofer torben.kimhofer@murdoch.edu.au

Examples

data(covid) model=pca(X)
#> Too many number of components, setting pc to 2
plotscores(model, an=list(Class=an$type, Clinic=an$hospital, id=1:nrow(an)), pc=c(1,2))
#> Error in names(x) <- value: 'names' attribute [3] must be the same length as the vector [0]