Learn R Programming

enpls (version 6.1.1)

cv.enspls: Cross Validation for Ensemble Sparse Partial Least Squares Regression

Description

K-fold cross validation for ensemble sparse partial least squares regression.

Usage

cv.enspls(x, y, nfolds = 5L, verbose = TRUE, ...)

Value

A list containing:

  • ypred - a matrix containing two columns: real y and predicted y

  • residual - cross validation result (y.pred - y.real)

  • RMSE - RMSE

  • MAE - MAE

  • Rsquare - Rsquare

Arguments

x

Predictor matrix.

y

Response vector.

nfolds

Number of cross-validation folds, default is 5. Note that this is the CV folds for the ensemble sparse PLS model, not the individual sparse PLS models. To control the CV folds for single sparse PLS models, please use the argument cvfolds.

verbose

Shall we print out the progress of cross-validation?

...

Arguments to be passed to enspls.fit.

Author

Nan Xiao <https://nanx.me>

See Also

See enspls.fit for ensemble sparse partial least squares regressions.

Examples

Run this code
# This example takes one minute to run
if (FALSE) {
data("logd1k")
x <- logd1k$x
y <- logd1k$y

set.seed(42)
cvfit <- cv.enspls(x, y, reptimes = 10)
print(cvfit)
plot(cvfit)
}

Run the code above in your browser using DataLab