Learn R Programming

mixOmics (version 2.6)

predict: Predict Method for PLS Regression and Sparse PLS

Description

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.

Usage

## S3 method for class 'pls':
predict(object, newdata, ...)

## S3 method for class 'spls':
predict(object, newdata, ...)

Arguments

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.

Value

  • predict produces a list with the following components:
  • predicta three dimensional array of predicted response values. The dimensions correspond to the observations, the response variables and the model dimension, respectively.
  • variatesmatrix of predicted variates.
  • B.hatmatrix of regression coefficients (without the intercept).

encoding

latin1

Details

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.

References

Tenenhaus, M. (1998). La r�gression PLS: th�orie et pratique. Paris: Editions Technic.

See Also

pls, spls.

Examples

Run this code
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, comp= 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)

Run the code above in your browser using DataLab