mrVipPCA: Principal Component Analysis of mrIML variable importance

mrVipPCAR Documentation

Principal Component Analysis of mrIML variable importance

Description

Principal Component Analysis of mrIML variable importance

Usage

mrVipPCA(mrVip_obj)

Arguments

mrVip_obj

A list returned by mrVip().

Value

A list of PCA results:

  • ⁠$PCA_plot⁠: Side-by-side plots of the different response models on the first two principal components (PCs) and a Scree plot.

  • ⁠$PC_outliers⁠: A list of the models flagged as outliers on at least one of the PCs.

  • ⁠$eigenvalues⁠: The eigenvalues associated with the principal components.

  • ⁠$PC_scores⁠: The PC scores of each response model.

Examples

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_vip <- mrVip(mrIML_rf, taxa = "Plas")

mrIML_rf_vip %>%
 mrVipPCA()


nfj1380/mrIML documentation built on June 2, 2025, 1:03 a.m.