Skip to contents

Process a list of multi-arm causal forest results: generate policy-tree and decision-tree plots, Qini curves, and difference-gain summaries, optionally saving each to disk.

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,
  model_names = NULL
)

Arguments

result_outcomes

List returned by margot_multi_arm_causal_forest().

policy_tree_args

List of args for margot_plot_policy_tree(). Default: list().

decision_tree_args

List of args for margot_plot_decision_tree(). Default: list().

dpi

Resolution (dpi) for saved plots. Default: 600.

width

Width (in inches) for saved plots. Default: 12.

height

Height (in inches) for saved plots. Default: 12.

save_plots

Logical; save plots to disk? Default: TRUE.

output_dir

Directory for saving plots. Default: here::here(push_mods).

spend

Numeric vector of spend levels for difference-gain summaries. Default: c(0.2, 0.5).

label_mapping

Named list mapping variable names to display labels. Default: NULL.

original_df

Optional data.frame of untransformed variables for axis annotations. Default: NULL.

model_names

Character vector of model names to process; NULL = all. Default: NULL.

Value

A named list; each element corresponds to a model and contains:

policy_tree_plot

ggplot of the policy-tree plot

policy_tree_interpretation

character interpretation

qini_plot

ggplot of the Qini curve

decision_tree_visualisation

ggplot of the decision tree

policy_combo_plot

ggplot of combined policy vs decision

diff_gain_summaries

list of difference-gain summaries per spend