data(NIR)
mod <- plsr(y ~ X, ncomp = 10, data = NIR[NIR$train,], CV = TRUE)
predplot(mod, ncomp = 1:6)
plot(mod, ncomp = 1:6) # Equivalent to the previous
## Both cross-validated and test set predictions:
predplot(mod, ncomp = 4:6, which = c("validation", "test"),
newdata = NIR[!NIR$train,])
data(sensory)
mod.sens <- plsr(Quality ~ Panel, ncomp = 4, data = sensory)
plot(mod.sens, ncomp = 2:4) # Several responses gives several plots
Run the code above in your browser using DataLab