glmnetr: Nested Cross Validation for the Relaxed Lasso and Other Machine Learning Models

Cross validation informed Relaxed LASSO, Artificial Neural Network (ANN), gradient boosting machine ('xgboost'), Random Forest ('RandomForestSRC'), Recursive Partitioning ('RPART') or step wise regression models are fit. Nested cross validation (or analogous for the random forest) is used to estimate and compare performances between these models. For some datasets, for example when the design matrix is not of full rank, 'glmnet' may have very long run times when fitting the relaxed lasso model, from our experience when fitting Cox models on data with many predictors and many patients, making it difficult to get solutions from either glmnet() or cv.glmnet(). This may be remedied with the 'path=TRUE' options when calling glmnet() and cv.glmnet(). Within the glmnetr package the approach of path=TRUE is taken by default. When fitting not a relaxed lasso model but an elastic-net model, then the R-packages 'nestedcv' <>, 'glmnetSE' <> or others may provide greater functionality when performing a nested CV. As with the 'glmnet' package, this package passes most relevant output to the output object and tabular and graphical summaries can be generated using the summary and plot functions. Use of the 'glmnetr' has many similarities to the 'glmnet' package and it is recommended that the user of 'glmnetr' also become familiar with the 'glmnet' package <>, with the "An Introduction to 'glmnet'" and "The Relaxed Lasso" being especially helpful in this regard.

Version: 0.4-4
Depends: R (≥ 3.4.0)
Imports: glmnet, survival, Matrix, xgboost, smoof, mlrMBO, ParamHelpers, randomForestSRC, rpart, torch
Suggests: R.rsp
Published: 2024-03-23
Author: Walter K Kremers ORCID iD [aut, cre], Nicholas B Larson [ctb]
Maintainer: Walter K Kremers < at>
License: GPL-3
Copyright: Mayo Foundation for Medical Education and Research
NeedsCompilation: no
CRAN checks: glmnetr results


Reference manual: glmnetr.pdf
Vignettes: An Overview of glmnetr
Using ann_tab_cv
Using stepreg


Package source: glmnetr_0.4-4.tar.gz
Windows binaries: r-devel:, r-release:, r-oldrel:
macOS binaries: r-release (arm64): glmnetr_0.4-4.tgz, r-oldrel (arm64): glmnetr_0.4-4.tgz, r-release (x86_64): glmnetr_0.4-4.tgz
Old sources: glmnetr archive


Please use the canonical form to link to this page.