plsda: Partial least squares discriminant analysis

View source: R/plsda.R

plsdaR Documentation

Partial least squares discriminant analysis

Description

Perform a PLS discriminant analysis

Usage

plsda(X, Y, nc, scale = TRUE, center = TRUE, cv = TRUE, nr_folds = 5)

Arguments

X

a matrix of predictor variables.

Y

a single vector indicate the group

nc

the number of pls components (the one joint components + number of orthogonal components ).

scale

logical indicating whether X must be scaled (suggest TRUE).

center

logical indicating whether X must be centered (suggest TRUE).

cv

logical indicating whether cross-validation will be performed or not (suggest TRUE).

nr_folds

nr_folds Integer to indicate the folds for cross validation.

Value

a list containing the following elements:

  • nc the number of components used(one joint components + number of orthogonal components

  • scores a matrix of scores corresponding to the observations in X, The components retrieved correspond to the ones optimized or specified.

  • Xloadings a matrix of loadings corresponding to the explanatory variables. The components retrieved correspond to the ones optimized or specified.

  • vip the VIP matrix.

  • xvar variance explained of X by each single component.

  • R2Y variance explained of Y by each single component.

  • codePRESSThe residual sum of squares for the samples which were not used to fit the model

  • codeQ2quality of cross-validation

Author(s)

Kai Guo

Examples

X <- matrix(rnorm(500),10,50)
Y <- rep(c("a","b"),each=5)
fit <- plsda(X,Y,2)

o2plsda documentation built on Aug. 12, 2022, 9:05 a.m.