mrCovar | R Documentation |
This function is a wrapper around mrFlashlight()
that plots the covariate
partial dependencies for a specified environmental/host variable. It also
filters the taxa based on standard deviation thresholds.
mrCovar(mrIMLobj, var, sdthresh = 0.05, ...)
mrIMLobj |
A list object output by |
var |
The variable of interest for calculating the profile. |
sdthresh |
The standard deviation threshold for filtering taxa (default: 0.05). |
... |
Arguments passed to |
A list of figures:
$partial_dep_curves
: The covariate partial dependence profiles for those
models that meet the sdthresh
requirement.
$partial_dep_avg
: The average partial dependence profile for all models.
All individual model partial dependence profiles are silhouetted in the
background.
$partial_dep_diff
: The distribution of the rates of change in probability
for the specified variable (the derivatives of the PD curves). Useful to
identify key threshold values in the variable.
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
)
mrIML_rf %>%
mrCovar(var = "scale.prop.zos", sdthresh = 0.05)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.