Skip to content

Commit 3a4bcd7

Browse files
Add Meta-Learners, Neural Causal, Causal Discovery, TMLE, Policy Learning, Robustness modules; update README
New modules: - robustness: spec_curve (Simonsohn 2020), robustness_report, subgroup_analysis - metalearners: S/T/X/R/DR-Learner + CATE diagnostics - neural_causal: TARNet, CFRNet, DragonNet - causal_discovery: NOTEARS, PC algorithm - tmle: TMLE + Super Learner - policy_learning: Policy Tree + policy value - conformal_causal, bcf, bunching, matrix_completion (scaffolds) - plots: interactive editor README rewritten with full 120-API feature list, honest Stata/R comparison, and robustness automation examples. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ed222cf commit 3a4bcd7

39 files changed

Lines changed: 12289 additions & 100 deletions

README.md

Lines changed: 236 additions & 99 deletions
Large diffs are not rendered by default.

src/statspai/__init__.py

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,23 @@
5252
from .postestimation import margins, marginsplot, test, lincom
5353
from .diagnostics import oster_bounds, mccrary_test, diagnose, het_test, reset_test, vif, sensemakr, rddensity, hausman_test, anderson_rubin_test
5454
from .inference import wild_cluster_bootstrap, aipw, ri_test
55-
from .plots import binscatter, set_theme
55+
from .plots import binscatter, set_theme, interactive, get_code
5656
from .utils import label_var, label_vars, get_label, get_labels, describe, pwcorr, winsor, read_data
5757
from .gmm import xtabond
58+
from .metalearners import metalearner, SLearner, TLearner, XLearner, RLearner, DRLearner
59+
from .metalearners import cate_summary, cate_by_group, cate_plot, cate_group_plot, predict_cate, compare_metalearners, gate_test, blp_test
5860
from .regression.heckman import heckman
5961
from .regression.quantile import qreg, sqreg
6062
from .regression.tobit import tobit
63+
from .neural_causal import tarnet, cfrnet, dragonnet, TARNet, CFRNet, DragonNet
64+
from .causal_discovery import notears, NOTEARS, pc_algorithm, PCAlgorithm
65+
from .tmle import tmle, TMLE, super_learner, SuperLearner
66+
from .policy_learning import policy_tree, PolicyTree, policy_value
67+
from .conformal_causal import conformal_cate, ConformalCATE
68+
from .bcf import bcf, BayesianCausalForest
69+
from .bunching import bunching, BunchingEstimator
70+
from .matrix_completion import mc_panel, MCPanel
71+
from .robustness import spec_curve, SpecCurveResult, robustness_report, RobustnessResult, subgroup_analysis, SubgroupResult
6172

6273
__all__ = [
6374
# Core
@@ -120,6 +131,8 @@
120131
# Plots
121132
"binscatter",
122133
"set_theme",
134+
"interactive",
135+
"get_code",
123136
# Utils
124137
"label_var",
125138
"label_vars",
@@ -161,4 +174,48 @@
161174
"wild_cluster_bootstrap",
162175
"aipw",
163176
"ri_test",
177+
# Meta-Learners (HTE)
178+
"metalearner",
179+
"SLearner",
180+
"TLearner",
181+
"XLearner",
182+
"RLearner",
183+
"DRLearner",
184+
# CATE Diagnostics
185+
"cate_summary",
186+
"cate_by_group",
187+
"cate_plot",
188+
"cate_group_plot",
189+
"predict_cate",
190+
"compare_metalearners",
191+
"gate_test",
192+
"blp_test",
193+
# Neural Causal Models
194+
"tarnet",
195+
"cfrnet",
196+
"dragonnet",
197+
"TARNet",
198+
"CFRNet",
199+
"DragonNet",
200+
# Causal Discovery
201+
"notears",
202+
"NOTEARS",
203+
"pc_algorithm",
204+
"PCAlgorithm",
205+
# TMLE
206+
"tmle",
207+
"TMLE",
208+
"super_learner",
209+
"SuperLearner",
210+
# Policy Learning
211+
"policy_tree",
212+
"PolicyTree",
213+
"policy_value",
214+
# Robustness
215+
"spec_curve",
216+
"SpecCurveResult",
217+
"robustness_report",
218+
"RobustnessResult",
219+
"subgroup_analysis",
220+
"SubgroupResult",
164221
]

src/statspai/bcf/__init__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
Bayesian Causal Forest (BCF) for heterogeneous treatment effects.
3+
4+
Decomposes the outcome into a prognostic function mu(X) and a
5+
treatment effect function tau(X), each modeled by BART:
6+
7+
Y_i = mu(X_i) + tau(X_i) * D_i + epsilon_i
8+
9+
This separation allows regularization-induced confounding (RIC) to be
10+
mitigated, producing better CATE estimates than standard BART.
11+
12+
References
13+
----------
14+
Hahn, P. R., Murray, J. S., & Carvalho, C. M. (2020).
15+
Bayesian Regression Tree Models for Causal Inference: Regularization,
16+
Confounding, and Heterogeneous Effects.
17+
Bayesian Analysis, 15(3), 965-1056.
18+
"""
19+
20+
from .bcf import bcf, BayesianCausalForest
21+
22+
__all__ = ['bcf', 'BayesianCausalForest']

0 commit comments

Comments
 (0)