Skip to contents

This function processes a subset of models (or all models by default), creates RATE (Rank Average Treatment Effect) plots for each model using the margot package, and optionally saves the plots.

Usage

margot_plot_rate_batch(
  models_binary,
  model_names = NULL,
  dpi = 300,
  width = 12,
  height = 8,
  save_plots = TRUE,
  output_dir = "rate_plots",
  remove_tx_prefix = TRUE,
  remove_z_suffix = TRUE,
  use_title_case = TRUE,
  remove_underscores = TRUE,
  label_mapping = NULL
)

Arguments

models_binary

A list of model results, where each element contains a 'rate_result' component.

model_names

Optional character vector of model names to process. Default NULL (all models).

dpi

The resolution of the saved plots in dots per inch. Default is 300.

width

The width of the saved plots in inches. Default is 12.

height

The height of the saved plots in inches. Default is 8.

save_plots

Logical indicating whether to save the plots to disk. Default is TRUE.

output_dir

The directory where plots should be saved. Default is "rate_plots".

remove_tx_prefix

Logical value indicating whether to remove the "tx_" prefix from labels. Default is TRUE.

remove_z_suffix

Logical value indicating whether to remove the "_z" suffix from labels. Default is TRUE.

use_title_case

Logical value indicating whether to convert labels to title case. Default is TRUE.

remove_underscores

Logical value indicating whether to remove underscores from labels. Default is TRUE.

label_mapping

Optional named list for custom label mappings. Keys should be original variable names (with or without "model_" prefix), and values should be the desired display labels. Default is NULL.

Value

A list containing the generated ggplot objects for each processed model.