cv.gglasso {gglasso} | R Documentation |
Does k-fold cross-validation for gglasso, produces a plot,
and returns a value for lambda
. This function is modified based on the cv
function from the glmnet
package.
cv.gglasso(x, y, group, lambda = NULL, pred.loss = c("misclass", "loss", "L1", "L2"), nfolds = 5, foldid, delta, ...)
x |
matrix of predictors, of dimension n*p; each row is an observation vector. |
y |
response variable. This argument should be quantitative for regression (least squares), and a two-level factor for classification (logistic model, huberized SVM, squared SVM). |
group |
a vector of consecutive integers describing the grouping of the coefficients (see example below). |
lambda |
optional user-supplied lambda sequence; default is
|
pred.loss |
loss to use for cross-validation error. Valid options are:
Default is |
nfolds |
number of folds - default is 5. Although |
foldid |
an optional vector of values between 1 and |
delta |
parameter delta only used in huberized SVM for computing log-likelihood on validation set, only available with |
... |
other arguments that can be passed to gglasso. |
The function runs gglasso
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.
an object of class cv.gglasso
is returned, which is a
list with the ingredients of the cross-validation fit.
lambda |
the values of |
cvm |
the mean cross-validated error - a vector of length
|
cvsd |
estimate of standard error of |
cvupper |
upper curve = |
cvlower |
lower curve = |
name |
a text string indicating type of measure (for plotting purposes). |
gglasso.fit |
a fitted |
lambda.min |
The optimal value of |
lambda.1se |
The largest value of |
Yi Yang and Hui Zou
Maintainer: Yi Yang <yi.yang6@mcgill.ca>
Yang, Y. and Zou, H. (2015), “A Fast Unified Algorithm for Computing Group-Lasso Penalized Learning Problems,” Statistics and Computing. 25(6), 1129-1141.
BugReport: https://github.com/emeryyi/gglasso
gglasso
, plot.cv.gglasso
, predict.cv.gglasso
, and coef.cv.gglasso
methods.
# load gglasso library library(gglasso) # load data set data(bardet) # define group index group <- rep(1:20,each=5) # 5-fold cross validation using group lasso # penalized logisitic regression cv <- cv.gglasso(x=bardet$x, y=bardet$y, group=group, loss="ls", pred.loss="L2", lambda.factor=0.05, nfolds=5)