powered by
The Cross-Validation of Classification and Regression models using Partial Least Squares
pls.cv(xtr, ytr, cv.fold = 5, maxcomp = NULL)
A data frame or a matrix of predictors.
A response vector. If a factor, classification is assumed, otherwise regression is assumed.
The fold, the defalut is 5.
Maximum number of components included within the models, if not specified, default is the variable (column) numbers in x.
the retrun a list containing four components:
plspred - the predicted values of the input data based on cross-validation
plspred
Error - error for all samples
Error
RMSECV - Root Mean Square Error for cross-validation
RMSECV
Q2 - R2 for cross-validation
Q2
This function performs k-fold cross validation for partial least squares regression and classification.
See rf.cv for the Cross-Validation of Classification and Regression models using Random Forest
rf.cv
# NOT RUN { training = read.csv(system.file('sysdata/training2.csv', package = 'BioMedR'), header = TRUE) y = training[, 1] x = training[, -1] pls.tr <- pls.cv(x, y) # }
Run the code above in your browser using DataLab