Nested Cross Validation for the Relaxed Lasso and Other Machine Learning Models
Overview
Cross validation informed Relaxed LASSO (or more generally elastic net), gradient boosting machine ('xgboost'), Random Forest ('RandomForestSRC'), Oblique Random Forest ('aorsf'), Artificial Neural Network (ANN), Recursive Partitioning ('RPART') or step wise regression models are fit. Cross validation leave out samples (leading to nested cross validation) or bootstrap out-of-bag samples are used to evaluate and compare performances between these models with results presented in tabular or graphical means. Calibration plots can also be generated, again based upon (outer nested) cross validation or bootstrap leave out (out of bag) samples. Note, at the time of this writing, in order to fit gradient boosting machine models one must install the packages 'DiceKriging' and 'rgenoud' using the install.packages() function. 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 by using the 'path=TRUE' option when calling glmnet() and cv.glmnet(). Within the 'glmnetr' package the approach of path=TRUE is taken by default. other packages doing similar include 'nestedcv' https://cran.r-project.org/package=nestedcv, 'glmnetSE' https://cran.r-project.org/package=glmnetSE which may provide different functionality when performing a nested CV. Use of the 'glmnetr' has many similarities to the 'glmnet' package and it could be helpful for the user of 'glmnetr' also become familiar with the 'glmnet' package https://cran.r-project.org/package=glmnet, with the "An Introduction to 'glmnet'" and "The Relaxed Lasso" being especially useful in this regard.
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-09
- ERROR12 OK, 1 ERROR2026-06-08
- OK14 OK2026-03-10
Documentation
- Help pages
- 52
- Examples that run
- 47%7 run in a plain check · 8 only when donttest examples are enabled (R CMD check --as-cran)
- Exported functions with examples
- 26%
- Documented parameters
- 100%
- Return-value docs
- 97%
- Help pages citing references
- 0%
- An Overview of glmnetr PDF
- An Overview of glmnetr PDF
- Calibration of Machine Learning Models PDF
- Calibration of Machine Learning Models PDF
- Elastic net models PDF
- Lasso and Ridge Stability PDF
- Ridge and Lasso PDF
- Using ann_tab_cv PDF
- Using ann_tab_cv PDF
- Using stepreg PDF
Show 2 moreHide 2 vignettes
- Using stepreg PDF
- Using stepreg PDF
Downloads
Dependencies
Installing glmnetr adds 110 packages (58 with compiled code, 89 MB of source tarballs). Heaviest: stringi 11 MB, data.table 5.7 MB, bslib 5.6 MB.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 0.6-4Latest
- RR 4.6.0 released · 2026-04-24
- 0.6-32025-12-16 · diff ↗
- 0.6-2
- 0.6-1
- RR 4.5.0 released · 2025-04-11
- 0.5-5
- 0.5-42024-10-24 · diff ↗
- 0.5-3
- 0.5-2
- 0.5-12024-05-12 · diff ↗ ·
removed 2 exports
predict_nested_rf, predict_nested_xgbadded 5 exports
diff_time1, nested.cis, nested.compare, orf_tune, rederive_orf - RR 4.4.0 released · 2024-04-24
- 0.4-62024-04-21 · diff ↗
- 0.4-5
- 0.4-42024-03-23 · diff ↗ ·
removed 6 exports
bsint, dtstndrz, prednn_tl, wtlast, wtmiddle, wtzeroadded 4 exports
predict_nested_rf, predict_nested_xgb, rederive_rf, rederive_xgb - 0.4-3
Show 11 earlier eventsHide 11 earlier events
- 0.4-2
- 0.4-1
- 0.3-12023-08-10 · diff ↗
- unarchivedReturned to CRAN2023-06-07
- 0.2-12023-06-07 · diff ↗
- archivedRemoved from CRAN2023-05-28issues were not corrected in time
- 0.2-02023-05-10 · diff ↗ ·
removed 1 export
difftime2added 15 exports
ann_tab_cv, ann_tab_cv_best, bsint, calceloss, diff_time, dtstndrz, factor.foldid, glmnetr.foldid, predict_ann_tab, prednn_tl, wtlast, wtmiddle, wtzero, xgb.simple, xgb.tuned - RR 4.3.0 released · 2023-04-21
- 0.1-22023-02-18 · diff ↗
- 0.1-12022-12-14
- RR 4.2.0 released · 2022-04-22
Package metadata
- First published
- 2022-12-14
- Total releases
- 20 / 4 yrs
- License
- GPL-3 OSI
- Copyright
- Mayo Foundation for Medical Education and Research
- Minimum R
- ≥ 3.4.0
- Download size
- 2.2 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("glmnetr")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-22, which the citation names so these numbers can be found later. More on citing and the projects behind them.