if (FALSE) {
## example of PLSR1 with the vehicles dataset
# predictand variable: price of vehicles
data(vehicles)
# apply plsreg1 extracting 2 components (no cross-validation)
pls1_one = plsreg1(vehicles[,1:12], vehicles[,13,drop=FALSE], comps=2, crosval=FALSE)
# apply plsreg1 with selection of components by cross-validation
pls1_two = plsreg1(vehicles[,1:12], vehicles[,13,drop=FALSE], comps=NULL, crosval=TRUE)
# apply plsreg1 extracting 5 components with cross-validation
pls1_three = plsreg1(vehicles[,1:12], vehicles[,13,drop=FALSE], comps=5, crosval=TRUE)
# plot variables
plot(pls1_one)
}
Run the code above in your browser using DataLab