Cross-validation for gcdnet

Description

Does k-fold cross-validation for gcdnet, produces a plot, and returns a value for lambda. This function is modified based on the cv function from the glmnet package.

Usage

1
cv.gcdnet(x, y, lambda, pred.loss, nfolds, foldid, delta,...)

Arguments

x

x matrix as in gcdnet.

y

response variable or class label y as in gcdnet.

lambda

optional user-supplied lambda sequence; default is NULL, and gcdnet chooses its own sequence.

nfolds

number of folds - default is 5. Although nfolds can be as large as the sample size (leave-one-out CV), it is not recommended for large datasets. Smallest value allowable is nfolds=3.

foldid

an optional vector of values between 1 and nfold identifying what fold each observation is in. If supplied, nfold can be missing.

pred.loss

loss function to use for cross-validation error. Valid options are:

  • "loss" Margin based loss function. When use least square loss "ls", it gives mean square error (MSE).

  • "misclass" only available for classification: it gives misclassification error.

Default is "loss".

delta

parameter delta only used in HHSVM for computing margin based loss function, only available with pred.loss = "loss".

...

other arguments that can be passed to gcdnet.

Details

The function runs gcdnet nfolds+1 times; the first to get the lambda sequence, and then the remainder to compute the fit with each of the folds omitted. The average error and standard deviation over the folds are computed.

Value

an object of class cv.gcdnet is returned, which is a list with the ingredients of the cross-validation fit.

lambda

the values of lambda used in the fits.

cvm

the mean cross-validated error - a vector of length length(lambda).

cvsd

estimate of standard error of cvm.

cvupper

upper curve = cvm+cvsd.

cvlower

lower curve = cvm-cvsd.

nzero

number of non-zero coefficients at each lambda.

name

a text string indicating type of measure (for plotting purposes).

gcdnet.fit

a fitted gcdnet object for the full data.

lambda.min

The optimal value of lambda that gives minimum cross validation error cvm.

lambda.1se

The largest value of lambda such that error is within 1 standard error of the minimum.

Author(s)

Yi Yang and Hui Zou
Maintainer: Yi Yang <yiyang@umn.edu>

References

Yang, Y. and Zou, H. (2012), "An Efficient Algorithm for Computing The HHSVM and Its Generalizations," Journal of Computational and Graphical Statistics, 22, 396-415.
BugReport: http://code.google.com/p/gcdnet/

Friedman, J., Hastie, T., and Tibshirani, R. (2010), "Regularization paths for generalized linear models via coordinate descent," Journal of Statistical Software, 33, 1.
http://www.jstatsoft.org/v33/i01/

See Also

gcdnet, plot.cv.gcdnet, predict.cv.gcdnet, and coef.cv.gcdnet methods.

Examples

1
2
3
4
5
data(FHT)
set.seed(2011)
cv=cv.gcdnet(FHT$x,FHT$y,
lambda2=0.1,pred.loss="loss", nfolds=5)
plot(cv)