| predict {integrOmics} | R Documentation |
Predicted values based on PLS regression or sparse PLS models. New responses and variates are predicted using a fitted model and a new matrix of observations.
## S3 method for class 'pls': predict(object, newdata, ...) ## S3 method for class 'spls': predict(object, newdata, ...)
object |
object of class inheriting from "pls" or "spls". |
newdata |
data matrix in which to look for for explanatory variables to be used for prediction. |
... |
not used currently. |
predict produces predicted values, obtained by evaluating the PLS
model returned by pls or spls in the frame newdata.
Variates for newdata are also returned.
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). |
Sébastien Déjean, Ignacio González and Kim-Anh Lê Cao
Tenenhaus, M. (1998). La régression PLS: théorie et pratique. Paris: Editions Technic.
data(linnerud)
X <- linnerud$exercise
Y <- linnerud$physiological
linn.pls <- pls(X, Y, ncomp = 2, mode = "classic")
indiv1 <- c(200, 40, 60)
indiv2 <- c(190, 45, 45)
newdata <- rbind(indiv1, indiv2)
colnames(newdata) <- colnames(X)
newdata
pred <- predict(linn.pls, newdata)
plotIndiv(linn.pls, 1, 2, rep.space = "X-variate")
points(pred$variates[, 1], pred$variates[, 2], pch = 19, cex = 1.2)
text(pred$variates[, 1], pred$variates[, 2],
c("new ind.1", "new ind.2"), pos = 3)