Utilities for 'Glmnet'

Provides a formula interface for the 'glmnet' package for elasticnet regression, a method for cross-validating the alpha parameter, and other quality-of-life tools.


Note for version 1.1.2

This version fixes a bug in the assignment of observations to crossvalidation folds in cva.glmnet. The impact is most serious for small datasets, where the number of observations per fold is relatively low. If you are using this function, it's highly recommended you update the package.


Some quality-of-life functions to streamline the process of fitting elastic net models with glmnet, specifically:

  • glmnet.formula provides a formula/data frame interface to glmnet.
  • cv.glmnet.formula does a similar thing for cv.glmnet.
  • Methods for predict and coef for both the above.
  • A function cva.glmnet to choose both the alpha and lambda parameters via cross-validation, following the approach described in the help page for cv.glmnet. Optionally does the cross-validation in parallel.
  • Methods for plot, predict and coef for the above.

You can install the development version from Github using devtools::install_github.

install.packages("devtools")
library(devtools)
install_github("hong-revo/glmnetUtils")
library(glmnetUtils)

News

glmnetUtils 1.1.2

  • Fixes a bug in the assignment of observations to crossvalidation folds in cva.glmnet. The impact is most serious for small datasets, where the number of observations per fold is relatively low. If you are using this function, it's highly recommended you update the package.

glmnetUtils 1.1.1

  • Fixes bug where nfolds argument was not being passed to glmnet::cv.glmnet.

glmnetUtils 1.1

  • Now allows interaction and expression terms without requiring use.model.frame=TRUE. This works in an additive fashion, ie the formula ~ a + b:c + d*e is treated as consisting of three terms, a, b:c and d*e each of which is processed independently of the others. A dot in the formula includes all main effect terms, ie ~ . + a:b + f(x) expands to ~ a + b + x + a:b + f(x) (assuming a, b and x are the only columns in the data). Note that a formula like ~ (a + b) + (c + d) will be treated as two terms, a + b and c + d.
  • The call component of a glmnet/cv.glmnet object that uses the original matrix/vector interface is now useful.
  • You can now explicitly specify the vector of crossvalidation folds (for the inner loop over lambda) when calling cva.glmnet.
  • Correctly handle non-syntactic factor variables in a formula.

glmnetUtils 1.0.2

  • Initial release to CRAN.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("glmnetUtils")

1.1.2 by Hong Ooi, 4 months ago


https://github.com/Hong-Revo/glmnetUtils


Browse source code at https://github.com/cran/glmnetUtils


Authors: Microsoft [cph] , Hong Ooi [aut, cre]


Documentation:   PDF Manual  


GPL-2 license


Imports stats, graphics, grDevices, glmnet, parallel, Matrix

Suggests knitr, rmarkdown, MASS, doParallel, testthat


Suggested by plotmo.


See at CRAN