From fd4116f2a22b7340e381211f00570fbcae5c7099 Mon Sep 17 00:00:00 2001 From: brandmaier Date: Mon, 30 Sep 2024 08:50:43 +0200 Subject: [PATCH] add quantile function --- R/boruta.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/R/boruta.R b/R/boruta.R index a765f14..5831899 100644 --- a/R/boruta.R +++ b/R/boruta.R @@ -35,6 +35,7 @@ boruta <- function(model, pAdjMethod = "none", alpha = .05, verbose = FALSE, + quant = 1, ...) { # detect model (warning: duplicated code) if (inherits(model, "MxModel") || inherits(model, "MxRAMModel")) { @@ -136,8 +137,11 @@ boruta <- function(model, # Compute shadow stats shadow_importances <- agvim[names(agvim) %in% shadow_names] - impHistory[runNo, "shadowMax"] <- - max_shadow_importance <- max(shadow_importances, na.rm=TRUE) + impHistory[runNo, "shadowMax"] <- max(shadow_importances, na.rm=TRUE) + + max_shadow_importance <- stats::quantile(shadow_importances, + probs=quant,na.rm=TRUE) + impHistory[runNo, "shadowMin"] <- min(shadow_importances, na.rm=TRUE) impHistory[runNo, "shadowMean"] <- mean(shadow_importances, na.rm=TRUE) agvim_filtered <- agvim[!(names(agvim) %in% shadow_names)]