Learn R Programming

gglasso (version 1.5.1)

coef.cv.gglasso: get coefficients or make coefficient predictions from a "cv.gglasso" object.

Description

This function gets coefficients or makes coefficient predictions from a cross-validated gglasso model, using the stored "gglasso.fit" object, and the optimal value chosen for lambda.

Usage

# S3 method for cv.gglasso
coef(object, s = c("lambda.1se", "lambda.min"), ...)

Value

The coefficients at the requested values for lambda.

Arguments

object

fitted cv.gglasso object.

s

value(s) of the penalty parameter lambda at which predictions are required. Default is the value s="lambda.1se" stored on the CV object, it is the largest value of lambda such that error is within 1 standard error of the minimum. Alternatively s="lambda.min" can be used, it is the optimal value of lambda that gives minimum cross validation error cvm. If s is numeric, it is taken as the value(s) of lambda to be used.

...

not used. Other arguments to predict.

Author

Yi Yang and Hui Zou
Maintainer: Yi Yang <yi.yang6@mcgill.ca>

Details

This function makes it easier to use the results of cross-validation to get coefficients or make coefficient predictions.

References

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

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

cv.gglasso, and predict.cv.gglasso methods.

Examples

Run this code

# load gglasso library
library(gglasso)

# load data set
data(colon)

# define group index
group <- rep(1:20,each=5)

# 5-fold cross validation using group lasso 
# penalized logisitic regression
cv <- cv.gglasso(x=colon$x, y=colon$y, group=group, loss="logit",
pred.loss="misclass", lambda.factor=0.05, nfolds=5)

# the coefficients at lambda = lambda.1se
pre = coef(cv$gglasso.fit, s = cv$lambda.1se)

Run the code above in your browser using DataLab