Predict Method for PLS, sPLS, gPLS, sgPLS, sPLDda, gPLSda, sgPLSda
predict.Rd
Predicted values based on PLS, sparse PLS, group PLS, sparse group PLS, PLSda, sparse PLSda, group PLSda, sparse group PLSda models. New responses and variates are predicted using a fitted model and a new matrix of observations.
Usage
# S3 method for class 'PLS'
predict(object, newdata, ...)
# S3 method for class 'sPLS'
predict(object, newdata, ...)
# S3 method for class 'gPLS'
predict(object, newdata, ...)
# S3 method for class 'sgPLS'
predict(object, newdata, ...)
# S3 method for class 'PLSda'
predict(object, newdata, method = c("all", "max.dist",
"centroids.dist", "mahalanobis.dist"), ...)
# S3 method for class 'sPLSda'
predict(object, newdata, method = c("all", "max.dist",
"centroids.dist", "mahalanobis.dist"), ...)
# S3 method for class 'gPLSda'
predict(object, newdata, method = c("all", "max.dist",
"centroids.dist", "mahalanobis.dist"), ...)
# S3 method for class 'sgPLSda'
predict(object, newdata, method = c("all", "max.dist",
"centroids.dist", "mahalanobis.dist"), ...)
Arguments
- object
object of class inheriting from
"PLS"
,"sPLS"
,"gPLS"
,"sgPLS"
,"PLSda"
,"sPLSda"
,"gPLSda"
or"sgPLSda"
.- newdata
data matrix in which to look for for explanatory variables to be used for prediction.
- method
method to be applied for
"PLSda"
,sPLSda
,gPLSda
orsgPLSda
to predict the class of new data, should be a subset of"centroids.dist"
,"mahalanobis.dist"
or"max.dist"
(see Details). Defaults to"all"
.- ...
not used currently.
Details
The predict
function for pls and spls object has been created by Sebastien Dejean, Ignacio Gonzalez, Amrit Singh and Kim-Anh Le Cao for mixOmics
package. Similar code is used for sPLS, gPLS, sgPLS, sPLSda, gPLSda, sgPLSda models performed by sgPLS
package.
predict
function produces predicted values, obtained by evaluating the sparse PLS, group PLS or sparse group PLS
model returned by "PLS"
, sPLS
, gPLS
or sgPLS
in the frame newdata
.
Variates for newdata
are also returned. The prediction values are calculated based on the regression coefficients of object$Y
onto object$variates$X
.
Different class prediction methods are proposed for "PLSda"
, sPLSda
, gPLSda
or sgPLSda
: "max.dist"
is the naive method to predict the class. It is based on the predicted matrix (object$predict
)
which can be seen as a probability matrix to assign each test data to a class. The class with the largest
class value is the predicted class. "centroids.dist"
allocates the individual \(x\) to the class of
\(Y\) minimizing \(dist(\code{x-variate}, G_l)\), where \(G_l\), \(l = 1,...,L\) are the centroids of
the classes calculated on the \(X\)-variates of the model. "mahalanobis.dist"
allocates the individual
\(x\) to the class of \(Y\) as in "centroids.dist"
but by using the Mahalanobis metric
in the calculation of the distance.
Value
predict
produces a list with the following components:
- predict
A three dimensional array of predicted response values. The dimensions correspond to the observations, the response variables and the model dimension, respectively.
- variates
Matrix of predicted variates.
- B.hat
Matrix of regression coefficients (without the intercept).
- class
vector or matrix of predicted class by using \(1,...,\)
ncomp
(sparse)PLS-DA components.- centroids
matrix of coordinates for centroids.