cv.kerndwd {kerndwd} | R Documentation |
cross-validation
Description
Carry out a cross-validation for kerndwd
to find optimal values of the tuning parameter lambda
.
Usage
cv.kerndwd(x, y, kern, lambda, nfolds=5, foldid, wt, ...)
Arguments
x |
A matrix of predictors, i.e., the matrix |
y |
A vector of binary class labels, i.e., the |
kern |
A kernel function. |
lambda |
A user specified |
nfolds |
The number of folds. Default value is 5. The allowable range is from 3 to the sample size. |
foldid |
An optional vector with values between 1 and |
wt |
A vector of length |
... |
Other arguments being passed to |
Details
This function computes the mean cross-validation error and the standard error by fitting kerndwd
with every fold excluded alternatively. This function is modified based on the cv
function from the glmnet
package.
Value
A cv.kerndwd
object including the cross-validation results is return..
lambda |
The |
cvm |
A vector of length |
cvsd |
A vector of length |
cvupper |
The upper curve: |
cvlower |
The lower curve: |
lambda.min |
The |
lambda.1se |
The largest value of |
cvm.min |
The cross-validation error corresponding to |
cvm.1se |
The cross-validation error corresponding to |
Author(s)
Boxiang Wang and Hui Zou
Maintainer: Boxiang Wang boxiang-wang@uiowa.edu
References
Wang, B. and Zou, H. (2018)
“Another Look at Distance Weighted Discrimination,"
Journal of Royal Statistical Society, Series B, 80(1), 177–198.
https://rss.onlinelibrary.wiley.com/doi/10.1111/rssb.12244
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.
https://www.jstatsoft.org/v33/i01/paper
See Also
Examples
set.seed(1)
data(BUPA)
BUPA$X = scale(BUPA$X, center=TRUE, scale=TRUE)
lambda = 10^(seq(3, -3, length.out=10))
kern = rbfdot(sigma=sigest(BUPA$X))
m.cv = cv.kerndwd(BUPA$X, BUPA$y, kern, qval=1, lambda=lambda, eps=1e-5, maxit=1e5)
m.cv$lambda.min