#805: Add node p-value display to plot_causal_tree - #976
Conversation
c672f99 to
d89e703
Compare
jeongyoonlee
left a comment
There was a problem hiding this comment.
The node p-values are naive in-sample within-node t-tests — the partition is learned from the same data and splits maximize effect separation, so they're anti-conservative (no honesty/selective-inference or multiple-testing correction) and are raw diff-in-means (valid only under in-node unconfoundedness). Fine as the diagnostic #805 asks for, but please add a docstring note on node_pvalues / plot_causal_tree(pvalue=...) that these are descriptive, not valid post-selection inference.
Minor: a zero-variance node makes ttest_ind return nan, rendered as p_value(g) = nan — worth mapping to N/A like the insufficient-samples branch.
Thanks for the thorough review! I've addressed these. |
Proposed changes
Add the ability to display treatment effect p-values at each node when plotting a causal tree via
plot_causal_tree. This addresses #805.When
node_pvalues=Trueis passed toCausalTreeRegressorduring fit, a Welch's t-test is computed at each node comparing treatment vs control outcomes. The resulting p-values can then be rendered in the plot by passingpvalue=Truetoplot_causal_tree.Usage:
Each node will display
p_value(group) = X.XXXXfor each treatment group. Nodes with fewer than 2 samples in either group showN/A.Types of changes
Checklist
Further comments
Implementation follows the same pattern as the existing
groups_cntfeature:node_pvalues=Truein the constructor enables computation duringfit()_compute_node_pvalues()traverses the tree viadecision_path(same approach as_count_groups_distribution)scipy.stats.ttest_ind,equal_var=False) which is standard for unequal group sizesThis PR was co-authored with AI assistance.