Skip to contents

The msep.PLS function allows to assess PLS models by cross-validation using\(MSEP\) criterion. This function returns a list including \(MSEP\) values for each number of components. msep.PLS gives also a suggestion about the number of components selection. A plot allows to visualize the model performance according to the number of components.

Usage

msep.PLS(object, ncomp = object$ncomp, K=nrow(object$X))

Arguments

object

Object of class inheriting from "pls".

ncomp

The number of components desired for MSEP computing (no more than the number of components computed in the model).

K

The number of blocks for cross-validation (leave-one-out by default).

Details

A leave-one-out cross-validation is used by default.

\(K\) must be a value between 2 and the the number of rows of the dataset used for training model.

MSEP is defined by mean of squared error between the true \(Y\) values and their associated predictions.

Value

MSEP.train

\(MSEP\) of the training set WITHOUT cross-validation

MSEP.cv

\(MSEP\) of the training set WITH cross-validation

h.best

Indice of the lowest MSEP.cv

See also

Examples

library(sgPLSdevelop)

## data and model creation 
d <- data.create(p = 10, list = TRUE)
n <- nrow(d$X)
ncomp.max <- 10
X <- d$X
Y <- d$Y
model <- PLS(X,Y,ncomp = ncomp.max, mode = "regression")

## using msep.PLS function
msep.res <- msep.PLS(model, ncomp = ncomp.max, K = n)

msep.res$MSEP.cv 
#> NULL
msep.res$h.best #number of components suggestion 
#> [1] 5