Generate standard policy-tree reporting text
Source:R/margot_policy_tree_reporting.R
margot_text_policy_tree.RdProduces cautious stock text for policy-tree reports. The text describes the reporting convention without making substantive claims about moderators.
Usage
margot_text_policy_tree(
source = c("generic", "heldout_cv", "display_tree"),
include_ci = TRUE,
include_plot_convention = TRUE,
collapse = TRUE
)Details
Policy-tree reporting separates the selected action learned by the fitted tree from the signed treatment-control score contrast computed on evaluation rows. Let \(\Gamma_{ja}\) denote the action score for observation \(j\) under action \(a\), let \(L\) denote a policy-tree leaf, and let \(E_L\) denote the evaluation observations routed to that leaf. For binary actions \(C\) and \(T\), the reported contrast is $$ \Delta_L = \frac{\sum_{j \in E_L} w_j\{\Gamma_{jT} - \Gamma_{jC}\}} {\sum_{j \in E_L} w_j}. $$ The stored selected action is learned on training observations \(S_L\): $$ \pi(L) = \arg\max_{a \in \{C,T\}} \frac{\sum_{j \in S_L} w_j \Gamma_{ja}}{\sum_{j \in S_L} w_j}. $$ If every displayed leaf has the same selected action, the tree describes variation in score-contrast magnitude rather than a selective rule that changes actions across leaves.