The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

NBvarsel

R-CMD-check

Variable selection for binary outcome prediction models using cross-validated Net Benefit as the optimization criterion.

Overview

NBvarsel evaluates predictor subsets by their contribution to clinical utility (Net Benefit), rather than purely statistical performance metrics like p-values. It supports:

Installation

You can install the development version of NBvarsel from GitHub:

# install.packages("pak")
pak::pak("LasaiBarrenada/NB_varsel")

Alternatively, install from a source tarball (.tar.gz):

install.packages("NBvarsel_0.1.0.tar.gz", repos = NULL, type = "source")

Quick Start

library(NBvarsel)

# Simulate data
set.seed(42)
n <- 500
df <- data.frame(
  X1 = rnorm(n), X2 = rbinom(n, 1, 0.7),
  X3 = rnorm(n), X4 = rbinom(n, 1, 0.5)
)
df$Y <- rbinom(n, 1, plogis(2 * df$X1 + 1.5 * df$X2 + 0.2 * df$X3))

# Define predictor costs
harms <- c(X1 = 0.1, X2 = 0.05, X3 = 0.1, X4 = 0.0001)

# Run exhaustive variable selection
result <- nb_varsel(
  data = df,
  outcome_var = "Y",
  costs = harms,
  mode = "exhaustive",
  splines = FALSE,
  permutation = TRUE,
  allow_parallel = FALSE
)

# Best model (highest cost-adjusted Net Benefit)
result$best_model_stats

# All evaluated models, sorted by Avg_Adj_Net_Benefit
result$all_models

Visualisation

# Two-panel plot: metric overview + predictor inclusion heatmap
all_subset_plot(result$all_models)

# Customise colors
all_subset_plot(
  result$all_models,
  highlight_color = "steelblue",
  tile_color = "#E64B35"
)

# Permutation importance bar chart
vif_results <- VIF_plot(result$all_models, color = "darkgreen")
vif_results$plot
head(vif_results$data)

Documentation

Full documentation and vignettes are available at https://lasaibarrenada.github.io/NB_varsel/.

Functions

Function Description
nb_varsel() Variable selection via cross-validated Net Benefit
all_subset_plot() Two-panel model comparison visualisation
VIF_plot() Permutation importance output (plot + table)

References

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.