if (FALSE) {
## example of PLSR2 with the vehicles dataset
data(vehicles)
# apply plsreg2 extracting 2 components (no cross-validation)
pls2_one = plsreg2(vehicles[,1:12], vehicles[,13:16], comps=2, crosval=FALSE)
# apply plsreg2 with selection of components by cross-validation
pls2_two = plsreg2(vehicles[,1:12], vehicles[,13:16], comps=NULL, crosval=TRUE)
# apply plsreg2 extracting 5 components with cross-validation
pls2_three = plsreg2(vehicles[,1:12], vehicles[,13:16], comps=5, crosval=TRUE)
# plot variables
plot(pls2_one)
}
Run the code above in your browser using DataLab