Skip to contents

Batch Processing of Policy Trees and Related Visualizations

Usage

margot_policy(
  result_outcomes,
  policy_tree_args = list(),
  decision_tree_args = list(),
  dpi = 600,
  width = 12,
  height = 12,
  save_plots = TRUE,
  output_dir = here::here(push_mods),
  spend = c(0.2, 0.5),
  label_mapping = NULL,
  original_df = NULL
)

Arguments

result_outcomes

A list containing the results from margot_multi_arm_causal_forest().

policy_tree_args

A list of arguments to pass to margot_plot_policy_tree(). Default is list().

decision_tree_args

A list of arguments to pass to margot_plot_decision_tree(). Default is list().

dpi

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

width

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

height

The height of saved plots in inches. Default is 12.

save_plots

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

output_dir

The directory to save plots in. Default is here::here(push_mods).

spend

A vector of spend levels to use for difference gain summaries. Default is c(0.2, 0.5).

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.

original_df

Optional dataframe with untransformed variables, used to display split values on the data scale.

Value

A list where each element corresponds to a model in the input `result_outcomes`. Each element is itself a list containing:

policy_tree_plot

A ggplot object of the policy tree plot

policy_tree_interpretation

A character string interpreting the policy tree

qini_plot

A ggplot object of the Qini plot

decision_tree_visualisation

A ggplot object visualizing the decision tree

policy_combo_plot

A ggplot object of the policy combo plot

diff_gain_summaries

A nested list containing difference gain summaries for each spend level