Partial Least Squares and Principal Components Regression

Functions to perform partial least squares regression (PLSR) or principal components regression (PCR), with a formula interface. Cross-validation can be used. Prediction, model extraction, plot, print and summary methods exist.

multivariate, regression
mvr(formula, ncomp, data, subset, na.action,
    method = c("kernelpls", "simpls", "oscorespls", "svdpc"),
    validation = c("none", "CV", "LOO"),
    model = TRUE, x = FALSE, y = FALSE, ...)
plsr(..., method = c("kernelpls", "simpls", "oscorespls"))
pcr(..., method = "svdpc")

The functions fit PLSR or PCR models with 1, $\ldots$, ncomp number of components. Multi-response models are fully supported.

Three PLSR algorithms are available: the kernel algorithm, SIMPLS and the classical orthogonal scores algorithm. One PCR algorithm is available: using the singular value decomposition. The type of regression is specified with the method argument. pcr and plsr are wrappers for mvr, with different values for method.

If validation = "CV", cross-validation is performed. The number and type of cross-validation segments are specified with the arguments segments and segment.type. See mvrCv for details. If validation = "LOO", leave-one-out cross-validation is performed. It is an error to specify the segments when validation = "LOO" is specified.

Note that the cross-validation is optimised for speed, and some generality has been sacrificed. Especially, the model matrix is calculated only once for the complete cross-validation, so models like y ~ msc(X) will not be properly cross-validated. For proper cross-validation of models where the model matrix must be updated/regenerated for each segment, use the separate function crossval.


  • mvr returns an object of class mvr. The object contains all components returned by the underlying fit function. In addition, it contains the following components:
  • validationif validation was requested, the results of the cross-validation. See mvrCv for details.
  • ncompthe number of components of the model.
  • methodthe method used to fit the model. See the argument method for possible values.
  • callthe function call.
  • termsthe model terms.
  • modelif model = TRUE, the model frame.
  • xif x = TRUE, the model matrix.
  • yif y = TRUE, the model response.


Martens, H., N�s, T. (1989) Multivariate calibration. Chichester: Wiley.

See Also,,,, mvrCv, loadings, scores, loading.weights, coef.mvr, predict.mvr, R2, MSEP, RMSEP

## Default methods:
NIR.pcr <- pcr(y ~ X, 6, data = NIR, CV = TRUE)
NIR.pls <- plsr(y ~ X, 6, data = NIR, CV = TRUE)

## Alternative methods:
NIR.oscorespls <- mvr(y ~ X, 6, data = NIR, CV = TRUE,
                      method = "oscorespls")
NIR.simpls <- mvr(y ~ X, 6, data = NIR, CV = TRUE,
                  method = "simpls")

Pn <- scale(sensory$Panel)
Ql <- scale(sensory$Quality)
sens.pcr <- pcr(Ql ~ Pn, ncomp = 4)
sens.pls <- plsr(Ql ~ Pn, ncomp = 4)
Documentation reproduced from package pls, version 1.0-1, License: GPL version 2

Community examples

Looks like there are no examples yet.