data(yeast)
set.seed(1)
# MSPE plot. eta is searched between 0.1 and 0.9 and
# the number of hidden components is searched between 1 and 10
cv <- cv.spls( yeast$x, yeast$y, K = c(1:10), eta = seq(0.1,0.9,0.1) )
# Optimal eta and K
cv$etaopt
cv$KoptRun the code above in your browser using DataLab