# glmnet v4.1-1

Monthly downloads

## Lasso and Elastic-Net Regularized Generalized Linear Models

Extremely efficient procedures for fitting the entire lasso or elastic-net regularization path for linear regression, logistic and multinomial regression models, Poisson regression, Cox model, multiple-response Gaussian, and the grouped multinomial regression. There are two new and important additions. The family argument can be a GLM family object, which opens the door to any programmed family. This comes with a modest computational cost, so when the built-in families suffice, they should be used instead. The other novelty is the relax option, which refits each of the active sets in the path unpenalized. The algorithm uses cyclical coordinate descent in a path-wise fashion, as described in the papers listed in the URL below.

## Readme

# Lasso and Elastic-Net Regularized Generalized Linear Models

We provide extremely efficient procedures for fitting the entire lasso or elastic-net regularization path for linear regression (gaussian), multi-task gaussian, logistic and multinomial regression models (grouped or not), Poisson regression and the Cox model. The algorithm uses cyclical coordinate descent in a path-wise fashion. Details may be found in Friedman, Hastie, and Tibshirani (2010), Simon et al. (2011), Tibshirani et al. (2012), Simon, Friedman, and Hastie (2013).

Version 3.0 is a major release with several new features, including:

- Relaxed fitting to allow models in the path to be refit without regularization. CV will select from these, or from specified mixtures of the relaxed fit and the regular fit;
- Progress bar to monitor computation;
- Assessment functions for displaying performance of models on test
data. These include all the measures available via
`cv.glmnet`

, as well as confusion matrices and ROC plots for classification models; - print methods for CV output;
- Functions for building the
`x`

input matrix for`glmnet`

that allow for*one-hot-encoding*of factor variables, appropriate treatment of missing values, and an option to create a sparse matrix if appropriate. - A function for fitting unpenalized a single version of any of the
GLMs of
`glmnet`

.

Version 4.0 is a major release that allows for any GLM family, besides the built-in families.

## References

*Journal of Statistical Software, Articles*33 (1): 1–22. https://doi.org/10.18637/jss.v033.i01.

*Journal of Statistical Software, Articles*39 (5): 1–13. https://doi.org/10.18637/jss.v039.i05.

*Journal of the Royal Statistical Society: Series B (Statistical Methodology)*74 (2): 245–66. https://doi.org/10.1111/j.1467-9868.2011.01004.x.

## Functions in glmnet

Name | Description | |

get_start | Get null deviance, starting mu and lambda max | |

glmnet-internal | Internal glmnet functions | |

stratifySurv | Add strata to a Surv object | |

Cindex | compute C index for a Cox model | |

assess.glmnet | assess performance of a 'glmnet' object using test data. | |

predict.glmnetfit | Get predictions from a glmnetfit fit object | |

obj_function | Elastic net objective function value | |

pen_function | Elastic net penalty value | |

print.cv.glmnet | print a cross-validated glmnet object | |

dev_function | Elastic net deviance value | |

fid | Helper function for Cox deviance and gradient | |

rmult | Generate multinomial samples from a probability matrix | |

elnet.fit | Solve weighted least squares (WLS) problem for a single lambda value | |

print.glmnet | print a glmnet object | |

bigGlm | fit a glm with all the options in glmnet | |

survfit.coxnet | Compute a survival curve from a coxnet object | |

glmnet.control | internal glmnet parameters | |

mycoxpred | Helper function to amend ... for new data in survfit.coxnet | |

beta_CVX | Simulated data for the glmnet vignette | |

deviance.glmnet | Extract the deviance from a glmnet object | |

response.coxnet | Make response for coxnet | |

na.replace | Replace the missing entries in a matrix columnwise with the entries in a supplied vector | |

coxgrad | Compute gradient for Cox model | |

makeX | convert a data frame to a data matrix with one-hot encoding | |

glmnet-package | Elastic net model paths for some generalized linear models | |

survfit.cv.glmnet | Compute a survival curve from a cv.glmnet object | |

cox.path | Fit a Cox regression model with elastic net regularization for a path of lambda values | |

cox.fit | Fit a Cox regression model with elastic net regularization for a single value of lambda | |

use.cox.path | Check if glmnet should call cox.path | |

mycoxph | Helper function to fit coxph model for survfit.coxnet | |

glmnet | fit a GLM with lasso or elasticnet regularization | |

predict.cv.glmnet | make predictions from a "cv.glmnet" object. | |

coef.glmnet | Extract coefficients from a glmnet object | |

cox_obj_function | Elastic net objective function value for Cox regression model | |

glmnet.fit | Fit a GLM with elastic net regularization for a single value of lambda | |

weighted_mean_sd | Helper function to compute weighted mean and standard deviation | |

cv.glmnet | Cross-validation for glmnet | |

coxnet.deviance | Compute deviance for Cox model | |

glmnet.path | Fit a GLM with elastic net regularization for a path of lambda values | |

get_cox_lambda_max | Get lambda max for Cox regression model | |

get_eta | Helper function to get etas (linear predictions) | |

plot.cv.glmnet | plot the cross-validation curve produced by cv.glmnet | |

glmnet.measures | Display the names of the measures used in CV for different "glmnet" families | |

plot.glmnet | plot coefficients from a "glmnet" object | |

No Results! |

## Vignettes of glmnet

Name | ||

assets/coxnet.RDS | ||

assets/glmnet_refs.bib | ||

assets/vignette_binomial.png | ||

assets/vignette_gaussian.png | ||

Coxnet.Rmd | ||

glmnet.Rmd | ||

glmnetFamily.Rmd | ||

relax.Rmd | ||

No Results! |

## Last month downloads

## Details

Type | Package |

Date | 2021-02-17 |

License | GPL-2 |

VignetteBuilder | knitr |

Encoding | UTF-8 |

URL | https://glmnet.stanford.edu, https://dx.doi.org/10.18637/jss.v033.i01, https://dx.doi.org/10.18637/jss.v039.i05 |

RoxygenNote | 7.1.1 |

NeedsCompilation | yes |

Packaged | 2021-02-18 01:22:34 UTC; hastie |

Repository | CRAN |

Date/Publication | 2021-02-21 17:40:03 UTC |

imports | foreach , methods , shape , survival , utils |

suggests | knitr , lars , rmarkdown , testthat , xfun |

depends | Matrix (>= 1.0-6) , R (>= 3.6.0) |

Contributors | Rob Tibshirani, Jerome Friedman, Balasubramanian Narasimhan, Noah Simon, Junyang Qian, Kenneth Tay |

#### Include our badge in your README

```
[![Rdoc](http://www.rdocumentation.org/badges/version/glmnet)](http://www.rdocumentation.org/packages/glmnet)
```