Skip to contents

This function processes multiple models, creates RATE (Rank Average Treatment Effect) plots for each model using the margot package, and optionally saves the plots.

Usage

margot_plot_batch_rate(
  models_binary,
  dpi = 300,
  width = 12,
  height = 8,
  save_plots = TRUE,
  output_dir = "rate_plots"
)

Arguments

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".

models_list

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

Value

A list containing the generated ggplot objects for each model.

Examples

if (FALSE) { # \dontrun{
# Assuming 'models_binary' is your list of model results
models_to_process <- list(
  model_t2_env_climate_chg_cause_z = models_binary$result$model_t2_env_climate_chg_cause_z,
  model_t2_env_climate_chg_concern_z = models_binary$result$model_t2_env_climate_chg_concern_z,
  model_t2_envefficacy_z = models_binary$result$model_t2_envefficacy_z,
  model_t2_env_climate_chg_real_z = models_binary$result$model_t2_env_climate_chg_real_z,
  model_t2_env_sat_nz_environment_z = models_binary$result$model_t2_env_sat_nz_environment_z
)

# Run the batch processing
rate_plot <- margot_plot_batch_rate(models_to_process, output_dir = "path/to/your/output/directory")

# Access individual plots
rate_plot$model_t2_env_climate_chg_cause_z
} # }