nestedcv
0.9.0Nested Cross-Validation with 'glmnet' and 'caret'
Overview
Implements nested k*l-fold cross-validation for lasso and elastic-net regularised linear models via the 'glmnet' package and other machine learning models via the 'caret' package doi:10.1093/bioadv/vbad048. Cross-validation of 'glmnet' alpha mixing parameter and embedded fast filter functions for feature selection are provided. Described as double cross-validation by Stone (1977) doi:10.1111/j.2517-6161.1977.tb01603.x. Also implemented is a method using outer CV to measure unbiased model performance metrics when fitting Bayesian linear and logistic regression shrinkage models using the horseshoe prior over parameters to encourage a sparse model as described by Piironen & Vehtari (2017) doi:10.1214/17-EJS1337SI.
13/07/2026
- Added
nestcv.explain(), a wrapper aroundshapr::explain()
for generating SHAP values from nestedcv models, replacing the
fastshap-based workflow due to the removal of fastshap from CRAN.
Returns the shapr object directly, so shapr print() and plot()
methods can be used; plot_shap_bar() and plot_shap_beeswarm() also accept
this object directly.
- Fixed
pred_train(),pred_train_class()andpred_SuperLearner()
erroring when called with a data.table (as shapr::explain() does
internally) by changing newdata to a data frame.
nestedcvstill works withfastshapfor users who prefer it; the
pred_* wrapper functions remain usable directly with fastshap::explain().
Show all changes in 0.9.0Hide the rest of the changes in 0.9.0
- Small fixes to handle updates to ggplot2.
From NEWS.md in the release
Install
Health
NOTERd cross-referencesr-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-patched-linux-x86_64, r-release-linux-x86_64
Unknown package ‘CORElearn’ in Rd xrefs
- NOTE7 OK, 6 NOTENow
- NOTE8 OK, 1 NOTE2026-07-16
- OK8 OK2026-07-15
- ERROR11 OK, 2 ERROR2026-05-28
- OK14 OK2026-03-10
Documentation
- Help pages
- 66
- Examples that run
- 31%5 run in a plain check (2 of them under a condition) · 11 only when donttest examples are enabled (R CMD check --as-cran)
- Exported functions with examples
- 26%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 5%
Downloads
Repository
- PRs merged (all time)
- 87%
- Median days to close, 50 most recently updated closed issues
- 5
- Median days to close, 50 most recently updated closed PRs
- 0
Forks over time
Issues over time
3 development-tooling and community-health practices detected across 2 families in the upstream repository
Checks run against github.com/myles-lewis/nestedcv on 2026-10-11.
Dependencies
Installing nestedcv adds 78 packages (45 with compiled code, 60 MB of source tarballs). Heaviest: stringi 11 MB, ggplot2 6.0 MB, data.table 5.7 MB.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- unarchivedReturned to CRAN2026-07-14
- 0.9.0Latest
- archivedRemoved from CRAN2026-06-10issues were not corrected in time
- RR 4.6.0 released · 2026-04-24
- unarchivedReturned to CRAN2026-04-10
- 0.8.22026-04-10 · diff ↗
- archivedRemoved from CRAN2026-03-31issues were not corrected in time
- RR 4.5.0 released · 2025-04-11
- 0.8.02025-03-10 · diff ↗ ·
removed 6 exports
pred_nestcv_glmnet_class1, pred_nestcv_glmnet_class2, pred_nestcv_glmnet_class3, pred_train_class1, pred_train_class2, pred_train_class3added 2 exports
pred_nestcv_glmnet_class, pred_train_class - 0.7.12
- 0.7.10
- 0.7.92024-07-04 · diff ↗
- RR 4.4.0 released · 2024-04-24
- 0.7.8
- 0.7.42024-01-30 · diff ↗
- 0.7.32023-12-04 · diff ↗ ·
removed 1 export
boxplot_modeladded 5 exports
boxplot_expression, pred_SuperLearner, repeatcv, repeatfolds, txtProgressBar2
Show 13 earlier eventsHide 13 earlier events
- 0.7.02023-10-26 · diff ↗
- 0.6.92023-08-22 · diff ↗
- 0.6.72023-07-02 · diff ↗ ·
added 5 exports
bin_stat_filter, class_stat_filter, cor_stat_filter, one_hot, stat_filter - 0.6.62023-06-08 · diff ↗
- 0.6.42023-05-30 · diff ↗
- 0.6.22023-05-15 · diff ↗
- RR 4.3.0 released · 2023-04-21
- 0.6.12023-04-16 · diff ↗ ·
added 17 exports
barplot_var_stability, cv_coef, cv_varImp, plot_shap_bar, plot_shap_beeswarm, plot_var_stability, pred_nestcv_glmnet, pred_nestcv_glmnet_class1, pred_nestcv_glmnet_class2, pred_nestcv_glmnet_class3, pred_train, pred_train_class1, pred_train_class2, pred_train_class3, ranger_filter, var_direction, var_stability - 0.4.42022-12-05 · diff ↗ ·
added 5 exports
innercv_preds, innercv_summary, train_preds, train_roc, train_summary - 0.4.0
- 0.3.02022-09-10 · diff ↗ ·
added 11 exports
boot_anova, boot_correl, boot_filter, boot_lm, boot_ttest, boot_wilcoxon, class_balance, plot_varImp, randomsample, smote, summary_vars - 0.2.32022-07-07
- RR 4.2.0 released · 2022-04-22
Package metadata
- First published
- 2022-07-07
- Total releases
- 20 / 4 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Download size
- 2.5 MB
Cite
Cite this package
Run in R for the authors' entry:
citation("nestedcv")The package provides a citation file, so citation() returns the authors' own entry.
It points to 10.1093/bioadv/vbad048.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-17, which the citation names so these numbers can be found later. More on citing and the projects behind them.