Learn R Programming

DiscriMiner (version 0.1-28)

plsDA: PLS Discriminant Analysis

Description

Performs a Partial Least Squares (PLS) Discriminant Analysis by giving the option to include a random leave-k fold out cross validation

Usage

plsDA(variables, group, autosel = TRUE, comps = 2,
    validation = NULL, learn = NULL, test = NULL,
    cv = "LOO", k = NULL, retain.models = FALSE)

Arguments

variables
matrix or data frame with explanatory variables
group
vector or factor with group memberships
autosel
logical indicating automatic selection of PLS components by cross-validation. Default autosel=TRUE
comps
integer greater than one indicating the number of PLS components to retain. Used only when autosel=FALSE
validation
type of validation, either NULL or "learntest". Default NULL
learn
optional vector of indices for a learn-set. Only used when validation="learntest". Default NULL
test
optional vector of indices for a test-set. Only used when validation="learntest". Default NULL
cv
string indicating the type of crossvalidation. Avialable options are "LOO" (Leave-One-Out) and "LKO" (Leave-K fold-Out)
k
fold left out if using LKO (usually 7 or 10)
retain.models
whether to retain lower models (i.e. all lower component results)

Value

  • An object of class "plsda", basically a list with the following elements:
  • functionstable with discriminant functions
  • confusionconfusion matrix
  • scoresdiscriminant scores for each observation
  • loadingsloadings
  • y.loadingsy loadings
  • classificationassigned class
  • error_ratemisclassification error rate
  • componentsPLS components
  • Q2quality of loo cross-validation
  • R2R-squared coefficients
  • VIPVariable Importance for Projection
  • comp_varscorrelations between components and variables
  • comp_groupcorrelations between components and groups

Details

When validation=NULL leave-one-out (loo) cross-validation is performed. When validation="learntest" validation is performed by providing a learn-set and a test-set of observations.

References

Tenenhaus M. (1998) La Regression PLS. Editions Technip, Paris.

Perez-Enciso M., Tenenhaus M. (2003) Prediction of clinical outcome with microarray data: a partial least squares discriminant analysis (PLS-DA) approach. Human Genetics 112: 581-592.

See Also

classify, geoDA, linDA, quaDA

Examples

Run this code
# load iris dataset
data(iris)

# PLS discriminant analysis specifying number of components = 2
my_pls1 = plsDA(iris[,1:4], iris$Species, autosel=FALSE, comps=2)
my_pls1$confusion
my_pls1$error_rate
# plot circle of correlations
plot(my_pls1)

# PLS discriminant analysis with automatic selection of components
my_pls2 = plsDA(iris[,1:4], iris$Species, autosel=TRUE)
my_pls2$confusion
my_pls2$error_rate

# linear discriminant analysis with learn-test validation
learning = c(1:40, 51:90, 101:140)
testing = c(41:50, 91:100, 141:150)
my_pls3 = plsDA(iris[,1:4], iris$Species, validation="learntest",
learn=learning, test=testing)
my_pls3$confusion
my_pls3$error_rate

Run the code above in your browser using DataLab