| plsda {caret} | R Documentation |
plsda is used to fit PLS models for classification.
plsda(x, ...) ## Default S3 method: plsda(x, y, ncomp = 2, ...) predict.plsda(object, newdata = NULL, ncomp = NULL, type = "class", ...)
x |
a matrix or data frame of predictors |
y |
a factor or indicator matrix for the discrete outcome. If a matrix, the entries must be either 0 or 1 and rows must add to one |
ncomp |
the number of components to include in the model |
... |
arguments to pass to plsr (code{plsda} only) |
object |
an object produced by plsda |
newdata |
a matrix or data frame of predictors |
type |
either "class", "prob" or "raw" to produce the predicted class, class probabilities or the raw model scores, respectively. |
If a factor is supplied, the appropriate indicator matrix is created by plsda.
A multivariate PLS model is fit to the indicator matrix using the plsr function.
To predict, the softmax function is used to normalize the model output into probability-like scores. The class with the largest score is the assigned output class.
For plsda, an object of class "plsda" and "mvr". The predict
method produces either a vector, matrix or three-dimensional array,
depending on the values of type of ncomp. For example,
specifying more than one value of ncomp with type =
"class" with produce a three dimensional array but the default
specification would produce a factor vector.
data(mdrr) tmpX <- scale(mdrrDescr) plsFit <- plsda(tmpX, mdrrClass, ncomp = 3) table(predict(plsFit), mdrrClass)