Learn R Programming

mrIML (version 2.2.0)

mrPdPlotBootstrap: Bootstrap Partial Dependence Plots

Description

This function extracts and plots the bootrapped partial dependence functions calculated by mrBootstrap() for each response variable.

Usage

mrPdPlotBootstrap(
  mrIML_obj,
  mrBootstrap_obj,
  vi_obj = NULL,
  target,
  global_top_var = 2
)

Value

A list with two elements:

  • [[1]]: A data frame of the partial dependence grid for each response model, predictor variable, and bootstrap.

  • [[2]]: A list of partial dependence plots for each predictor variable in the target response model.

Arguments

mrIML_obj

A list object returned by mrIMLpredicts().

mrBootstrap_obj

A list object returned by mrBootstrap().

vi_obj

A list object returned by mrVip(). If vi_obj is not provided, then it is created inside mrPD_bootstrap by running mrVip().

target

The target variable for generating plots.

global_top_var

The number of top variables to consider (default: 2).

Examples

Run this code
if (FALSE) { # identical(Sys.getenv("NOT_CRAN"), "true")
mrIML_rf <- mrIML::mrIML_bird_parasites_RF

mrIML_rf_boot <- mrIML_rf %>%
  mrBootstrap(num_bootstrap = 50)

mrIML_rf_PD <- mrPdPlotBootstrap(
  mrIML_rf,
  mrIML_rf_boot,
  target = "Plas",
  global_top_var = 4
)

head(mrIML_rf_PD[[1]])
mrIML_rf_PD[[2]]
}

Run the code above in your browser using DataLab