cv.spls {spls} | R Documentation |
Draw the heatmap-type plot of the v-fold cross-validated mean square prediction error and return the optimal eta (thresholding parameter) and K (number of hidden components).
cv.spls( x, y, fold=10, K, eta, kappa=0.5, select="pls2", fit="simpls", scale.x=TRUE, scale.y=FALSE )
x |
Matrix of predictors. |
y |
Vector or matrix of responses. |
fold |
Number of cross-validation folds. Default is 10-folds. |
K |
Number of hidden components. |
eta |
Thresholding parameter. eta should be between 0 and 1. |
kappa |
Parameter to control the effect of
the concavity of the objective function
and the closeness of the original and surrogate direction vectors.
kappa is relevant only when the responses are multivariate.
kappa should be between 0 and 0.5. Default is 0.5. |
select |
PLS algorithm for variable selection.
Alternatives are "pls2" or "simpls" .
Default is "pls2" . |
fit |
PLS algorithm for model fitting. Alternatives are
"kernelpls" , "widekernelpls" ,
"simpls" , or "oscorespls" .
Default is "simpls" . |
scale.x |
Scale the predictors by dividing each predictor variable by its sample standard deviation? |
scale.y |
Scale the responses by dividing each response variable by its sample standard deviation? |
Invisibly returns a list with components:
mspemat |
Matrix of the cross-validated mean squared prediction error.
Rows correspond to eta and
columns correspond to the number of components (K ). |
eta.opt |
Optimal eta . |
K.opt |
Optimal K . |
Dongjun Chung, Hyonho Chun, and Sunduz Keles.
Chun, H. and Keles, S. (2007). "Sparse partial least squares for simultaneous dimension reduction and variable selection", (http://www.stat.wisc.edu/~keles/Papers/SPLS_Nov07.pdf).
print.spls
, plot.spls
, predict.spls
,
and coef.spls
.
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$eta.opt cv$K.opt (spls( yeast$x, yeast$y, eta=cv$eta.opt, K=cv$K.opt ))