Learn R Programming

enpls (version 6.1)

cv.enpls: Cross Validation for Ensemble Partial Least Squares Regression

Description

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

Usage

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

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 PLS model, not the individual PLS models. To control the CV folds for single PLS models, please use the argument cvfolds.

verbose

Shall we print out the progress of cross-validation?

...

Arguments to be passed to enpls.fit.

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

See Also

See enpls.fit for ensemble partial least squares regressions.

Examples

Run this code
# NOT RUN {
data("alkanes")
x <- alkanes$x
y <- alkanes$y

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

Run the code above in your browser using DataLab