Skip to content

Commit

Permalink
add quantile function
Browse files Browse the repository at this point in the history
  • Loading branch information
brandmaier committed Sep 30, 2024
1 parent b9d6ba4 commit fd4116f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions R/boruta.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down Expand Up @@ -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)]
Expand Down

0 comments on commit fd4116f

Please sign in to comment.