cv.sdwd {sdwd} | R Documentation |
Conducts a k-fold cross-validation for sdwd
and returns the suggested values of the L1 parameter lambda
.
cv.sdwd(x, y, lambda, nfolds, foldid, ...)
x |
A matrix of predictors, i.e., the |
y |
A vector of binary class labels, i.e., the |
lambda |
Default is |
nfolds |
The number of folds. Default value is 5. The allowable range is from 3 to the sample size. Larger |
foldid |
An optional vector with values between 1 and |
... |
Other arguments that can be passed to sdwd. |
This function runs sdwd
to the sparse DWD by excluding every fold alternatively, and then computes the mean cross-validation error and the standard deviation. This function is modified based on the cv
function from the gcdnet
and the glmnet
packages.
A cv.sdwd
object is returned, which includes the cross-validation fit.
lambda |
The |
cvm |
A vector of length |
cvsd |
A vector of length |
cvupper |
The upper curve: |
cvlower |
The lower curve: |
nzero |
Numbers of non-zero coefficients at each |
name |
“Mis-classification error", for plotting purposes. |
sdwd.fit |
A fitted |
lambda.min |
The |
lambda.1se |
The largest value of |
cv.min |
The minimum cross validation error. |
cv.1se |
The cross validation error associated with |
Boxiang Wang and Hui Zou
Maintainer: Boxiang Wang boxiang@umn.edu
Wang, B. and Zou, H. (2015)
“Sparse Distance Weighted Discrimination", Journal of Computational and Graphical Statistics, forthcoming.
http://arxiv.org/abs/1501.06066
Yang, Y. and Zou, H. (2013)
“An Efficient Algorithm for Computing the HHSVM and Its Generalizations",
Journal of Computational and Graphical Statistics, 22(2), 396–415
http://users.stat.umn.edu/~yiyang/resources/papers/JCGS_gcdnet.pdf
Friedman, J., Hastie, T., and Tibshirani, R. (2010), "Regularization paths for generalized
linear models via coordinate descent," Journal of Statistical Software, 33(1), 1–22
http://www.jstatsoft.org/v33/i01/paper
sdwd
, plot.cv.sdwd
, predict.cv.sdwd
, and coef.cv.sdwd
methods.
data(colon) colon$x = colon$x[ ,1:100] # this example only uses the first 100 columns n = nrow(colon$x) set.seed(1) id = sample(n, trunc(n/3)) cvfit = cv.sdwd(colon$x[-id,], colon$y[-id], lambda2=1, nfolds=5) plot(cvfit) predict(cvfit, newx=colon$x[id,], s="lambda.min")