mrVip | R Documentation |
mrIML
models.Summarizes variable importance in a mrIML
model at both a global
(across all the response models) and local (for individual response models) level.
This can be done for a plain mrIML
model or bootstrap results obtained from
mrBootstrap()
.
mrVip(
mrIMLobj,
mrBootstrap_obj = NULL,
threshold = 0.1,
global_top_var = 10,
local_top_var = 5,
taxa = NULL,
model_perf = NULL
)
mrIMLobj |
A list object output by |
mrBootstrap_obj |
A list of bootstrap results output by |
threshold |
The performance threshold for response models (AUC for classification and R2 for regression). Only response models that meet this performance criterion are plotted. |
global_top_var |
The number of top global variables to display (default: 10). |
local_top_var |
The number of top local variables for each response to display (default: 5). |
taxa |
A character string identifying which response model should be plotted. |
model_perf |
A list object containing model performance metrics output
by |
A list containing:
$vi_data
: Variable importance data in its raw form (including bootstrap
samples if mrBootstrap_obj
was supplied).
$vi_tbl
: Variable importance data point estimates.
$vi_plot
: A grouped plot of the most important variables both globally and
for the individual response models.
library(tidymodels)
# Without bootstrap
data <- MRFcov::Bird.parasites
Y <- data %>%
select(-scale.prop.zos) %>%
select(order(everything()))
X <- data %>%
select(scale.prop.zos)
model_rf <- rand_forest(
trees = 50, # 50 trees are set for brevity. Aim to start with 1000
mode = "classification",
mtry = tune(),
min_n = tune()
) %>%
set_engine("randomForest")
mrIML_rf <- mrIMLpredicts(
X = X,
Y = Y,
X1 = Y,
Model = model_rf,
prop = 0.7,
k = 2,
racing = FALSE
)
mrVip(mrIML_rf, taxa = "Plas")
# With bootstrap
mrIML_rf_boot <- mrIML_rf %>%
mrBootstrap(num_bootstrap = 5)
mrIML_rf_vip <- mrVip(
mrIML_rf,
mrBootstrap_obj = mrIML_rf_boot
)
mrIML_rf_vip
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.