mr_Covar | R Documentation |
This function calculates the covariate partial dependency plot for a specified environmental/host variable. It also filters the taxa based on standard deviation thresholds and visualizes the results.
mr_Covar(yhats, Y, X, X1, var, sdthresh = 0.05)
yhats |
A list of model predictions. |
Y |
The response data. |
X |
The predictor data. |
X1 |
Additional predictor data excluding the variable of interest. |
var |
The variable of interest for calculating the profile. |
sdthresh |
The standard deviation threshold for filtering taxa (default: 0.05). |
A plot displaying the covariate profile and change in probability for the specified variable.
## Not run:
# Example usage:
#set up analysis
Y <- dplyr::select(Bird.parasites, -scale.prop.zos)%>%
dplyr::select(sort(names(.)))#response variables eg. SNPs, pathogens, species....
X <- dplyr::select(Bird.parasites, scale.prop.zos) # feature set
X1 <- Y %>%
dplyr::select(sort(names(.)))
model_rf <-
rand_forest(trees = 100, mode = "classification", mtry = tune(), min_n = tune()) %>% #100 trees are set for brevity. Aim to start with 1000
set_engine("randomForest")
yhats_rf <- mrIMLpredicts(X=X, Y=Y,
X1=X1,'Model=model_rf ,
balance_data='no',mode='classification',
tune_grid_size=5,seed = sample.int(1e8, 1),'morans=F,
prop=0.7, k=5, racing=T) #
ModelPerf <- mrIMLperformance(yhats_rf, Model=model_rf, Y=Y, mode='classification')
covar <- mr_Covar(yhats, X=X,X1=X1, Y=Y, var='scale.prop.zos', sdthresh =0.01) #sdthrsh just plots taxa responding the most.
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.