plsDA: PLS Discriminant Analysis

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/plsDA.R

Description

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

Usage

1
2
3
  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)

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.

Value

An object of class "plsda", basically a list with the following elements:

functions

table with discriminant functions

confusion

confusion matrix

scores

discriminant scores for each observation

loadings

loadings

y.loadings

y loadings

classification

assigned class

error_rate

misclassification error rate

components

PLS components

Q2

quality of loo cross-validation

R2

R-squared coefficients

VIP

Variable Importance for Projection

comp_vars

correlations between components and variables

comp_group

correlations between components and groups

Author(s)

Charles Determan Jr, Gaston Sanchez

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
# 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

## End(Not run)

Example output

            predicted
original     setosa versicolor virginica
  setosa         49          1         0
  versicolor      0         30        20
  virginica       0          7        43
[1] 0.1866667
            predicted
original     setosa versicolor virginica
  setosa         49          1         0
  versicolor      0         30        20
  virginica       0          7        43
[1] 0.1866667
            predicted
original     setosa versicolor virginica
  setosa          9          1         0
  versicolor      0          8         2
  virginica       0          2         8
[1] 0.1666667

DiscriMiner documentation built on May 1, 2019, 10:32 p.m.