Learn R Programming

BioMedR (version 1.2.1)

pls.cv: The Cross-Validation of Classification and Regression models using Partial Least Squares

Description

The Cross-Validation of Classification and Regression models using Partial Least Squares

Usage

pls.cv(xtr, ytr, cv.fold = 5, maxcomp = NULL)

Arguments

xtr

A data frame or a matrix of predictors.

ytr

A response vector. If a factor, classification is assumed, otherwise regression is assumed.

cv.fold

The fold, the defalut is 5.

maxcomp

Maximum number of components included within the models, if not specified, default is the variable (column) numbers in x.

Value

the retrun a list containing four components:

  • plspred - the predicted values of the input data based on cross-validation

  • Error - error for all samples

  • RMSECV - Root Mean Square Error for cross-validation

  • Q2 - R2 for cross-validation

Details

This function performs k-fold cross validation for partial least squares regression and classification.

See Also

See rf.cv for the Cross-Validation of Classification and Regression models using Random Forest

Examples

Run this code
# 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