glmNet: Fit GLMs or Cox Models with Lasso or Elastic Net

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Fit a generalized linear model or Cox model via the cyclic coordinate descent algorithm using the functions glmnet and cv.glmnet in the package glmnet.

Usage

1
2
3
4
5
    
glmNet(x, y, family = c("gaussian", "binomial", "poisson", "cox"), offset = NULL,
       alpha = c(1, 0.5, 0), lambda,
       penalty.factor = rep(1, ncol(x)), nfolds = 10, ncv = 10, 
       verbose = FALSE)

Arguments

x, y, family, offset, alpha, lambda, penalty.factor, nfolds

These arguments are the same as in the functions glmnet and cv.glmnet in the package glmnet.

ncv

repeated number of cross-validation.

verbose

logical. If TRUE, print out the computational time and progress.

Details

The function cv.glmnet performs cross-validation to determine an optimal penalty lambda. Since the folds are selected at random, the estimate of the optimal penalty is not stable and depends on the folds. This function does K-fold cross-validation ncv times and uses the mean of the ncv penalty values as the estimate of the optimal penalty lambda, and then fits the elastic net model (including lasso and ridge) using the optimal penalty lambda.

Value

This function returns all outputs from the function glmnet, and also prior.scale, which can be used in Bayesian hierarchical models.

Author(s)

Nengjun Yi, nyi@uab.edu

References

Friedman, J., Hastie, T. and Tibshirani, R. (2010) Regularization Paths for Generalized Linear Models via Coordinate Descent. J Stat Softw 33, 1-22.

Simon, N., Friedman, J., Hastie, T. & Tibshirani, R. (2011) Regularization Paths for Cox's Proportional Hazards Model via Coordinate Descent. Journal of Statistical Software 39, 1-13.

See Also

glmnet, bmlasso, cv.glmnet

Examples

1
 see examples in bmlasso and cv.bh. 

nyiuab/BhGLM documentation built on Jan. 9, 2022, 3:31 p.m.