|
6 | 6 | [](https://github.com/brycewang-stanford/statspai/actions) |
7 | 7 | [](https://pepy.tech/projects/statspai) |
8 | 8 |
|
9 | | -StatsPAI is a unified Python package for causal inference and applied econometrics. One `import`, 150+ functions, covering the complete empirical research workflow — from classical econometrics to cutting-edge ML/AI causal methods to publication-ready tables in Word, Excel, and LaTeX. |
| 9 | +StatsPAI is a unified Python package for causal inference and applied econometrics. One `import`, 170+ functions, covering the complete empirical research workflow — from classical econometrics to cutting-edge ML/AI causal methods to publication-ready tables in Word, Excel, and LaTeX. |
10 | 10 |
|
11 | 11 | It brings R's [Causal Inference Task View](https://cran.r-project.org/web/views/CausalInference.html) (fixest, did, rdrobust, gsynth, DoubleML, MatchIt, CausalImpact, ...) and Stata's core econometrics commands into a single, consistent Python API. |
12 | 12 |
|
@@ -344,7 +344,7 @@ sp.subgroup_analysis(df, formula="wage ~ education + experience", |
344 | 344 | ## API at a Glance |
345 | 345 |
|
346 | 346 | ```text |
347 | | -150+ public functions/classes |
| 347 | +170+ public functions/classes |
348 | 348 |
|
349 | 349 | Regression: regress, ivreg, panel, heckman, qreg, sqreg, tobit, xtabond |
350 | 350 | DID: did, did_2x2, callaway_santanna, sun_abraham, bacon_decomposition, honest_did |
@@ -373,6 +373,67 @@ Output: modelsummary, outreg2, sumstats, balance_table, tab, coefplot, b |
373 | 373 |
|
374 | 374 | --- |
375 | 375 |
|
| 376 | +## Release Notes |
| 377 | + |
| 378 | +### v0.4.0 (2026-04-05) — Module Architecture Overhaul |
| 379 | + |
| 380 | +**Major refactoring and expansion of core modules (+5,800 lines of new code):** |
| 381 | + |
| 382 | +- **DID**: Added Triple Differences (`ddd()`), one-call `did_analysis()` workflow (auto design detection → Bacon decomposition → estimation → event study → sensitivity), and 8 publication-ready plot functions (`parallel_trends_plot`, `bacon_plot`, `group_time_plot`, `enhanced_event_study_plot`, `treatment_rollout_plot`, `sensitivity_plot`, `cohort_event_study_plot`) |
| 383 | +- **Synthetic Control**: Modular rewrite — `demeaned_synth()`, `robust_synth()` (penalized SCM), `gsynth()` (Generalized SCM with interactive fixed effects), `staggered_synth()` (multi-unit staggered adoption), `conformal_synth()` (distribution-free inference), and comprehensive `synth_plot()` / `synth_weight_plot()` / `synth_gap_plot()` |
| 384 | +- **Panel**: Major expansion of `panel()` — Hausman test, Breusch-Pagan LM, Pesaran CD, Wooldridge autocorrelation, panel unit root tests; added `panel_summary_plot()`, `fe_plot()`, `re_comparison_plot()` |
| 385 | +- **RD**: New `rd_diagnostics()` suite — bandwidth sensitivity, placebo cutoffs, donut-hole robustness, covariate balance at cutoff, density test |
| 386 | +- **IV / 2SLS**: Rewritten `ivreg()` with proper first-stage diagnostics (Cragg-Donald, Kleibergen-Paap), weak IV detection, Sargan-Hansen overidentification test, Anderson canonical correlation test, Stock-Yogo critical values |
| 387 | +- **Matching**: Enhanced `match()` — added CEM (Coarsened Exact Matching), optimal matching, genetic matching; improved balance diagnostics with Love plot and standardized mean difference |
| 388 | +- **DAG**: Expanded `dag()` with 15+ built-in example DAGs (`dag_example()`), `dag_simulate()` for data generation from causal graphs, backdoor/frontdoor criterion identification |
| 389 | +- **Causal Impact**: Enhanced Bayesian structural time-series with automatic model selection and improved inference |
| 390 | +- **AI Agent Registry**: Expanded `list_functions()`, `describe_function()`, `function_schema()`, `search_functions()` for LLM/agent tool-use integration |
| 391 | +- **CausalResult**: Added `.to_json()`, `.to_dict()`, enhanced `.summary()` formatting |
| 392 | + |
| 393 | +### v0.3.1 (2025-12-20) |
| 394 | + |
| 395 | +- Fix PyPI badge displaying stale version |
| 396 | + |
| 397 | +### v0.3.0 (2025-12-20) — ML & Advanced Causal Methods |
| 398 | + |
| 399 | +- **Meta-Learners**: S/T/X/R/DR-Learner for CATE estimation with `compare_metalearners()` and CATE diagnostics (`gate_test`, `blp_test`) |
| 400 | +- **Neural Causal Models**: TARNet, CFRNet, DragonNet for deep CATE estimation |
| 401 | +- **Causal Discovery**: `notears()` (continuous DAG optimization), `pc_algorithm()` (constraint-based) |
| 402 | +- **TMLE**: Targeted Maximum Likelihood Estimation with Super Learner |
| 403 | +- **Policy Learning**: `policy_tree()` optimal treatment rules, `policy_value()` evaluation |
| 404 | +- **Conformal Causal**: Distribution-free prediction intervals for ITE |
| 405 | +- **Bayesian Causal Forest**: `bcf()` with separate prognostic/treatment functions |
| 406 | +- **Dose-Response**: Continuous treatment GPS curves |
| 407 | +- **Bounds**: Lee bounds (sample selection), Manski bounds (partial identification) |
| 408 | +- **Interference**: `spillover()` direct + indirect effect decomposition |
| 409 | +- **DTR**: `g_estimation()` multi-stage optimal treatment regimes |
| 410 | +- **Multi-Treatment**: AIPW for multi-valued treatments |
| 411 | +- **Bunching**: Kink/notch bunching estimator with elasticity |
| 412 | +- **Matrix Completion**: `mc_panel()` nuclear-norm panel estimator |
| 413 | +- **Robustness**: `spec_curve()`, `robustness_report()`, `subgroup_analysis()` |
| 414 | +- **New Regression**: DeepIV, Heckman selection, quantile regression, Tobit, Arellano-Bond GMM |
| 415 | +- **New Diagnostics**: E-value, Anderson-Rubin weak IV test, Sensemakr, RD density test |
| 416 | +- **Other**: Entropy balancing, Sun-Abraham event study, Bacon decomposition, HonestDiD |
| 417 | + |
| 418 | +### v0.2.0 (2025-11-15) — Post-Estimation & Output |
| 419 | + |
| 420 | +- **Post-Estimation**: `margins()`, `marginsplot()`, `test()`, `lincom()` |
| 421 | +- **Output Tables**: `modelsummary()`, `outreg2()`, `sumstats()`, `balance_table()`, `tab()`, `coefplot()`, `binscatter()` |
| 422 | +- **Inference**: `wild_cluster_bootstrap()`, `aipw()`, `ri_test()` |
| 423 | +- **New Modules**: DML, Causal Forest, Matching (PSM/Mahalanobis), Synthetic Control (ADH + SDID), Panel (FE/RE/FD), Causal Impact, Mediation, Bartik IV |
| 424 | +- **Diagnostics**: `oster_bounds()`, `mccrary_test()`, `hausman_test()`, `het_test()`, `reset_test()`, `vif()` |
| 425 | +- **Utilities**: Variable labeling, `describe()`, `pwcorr()`, `winsor()`, `read_data()` |
| 426 | + |
| 427 | +### v0.1.0 (2025-10-01) — Initial Release |
| 428 | + |
| 429 | +- Core regression: `regress()` OLS with robust/clustered/HAC standard errors |
| 430 | +- Instrumental variables: `ivreg()` 2SLS |
| 431 | +- Difference-in-Differences: `did()`, `did_2x2()`, `callaway_santanna()` |
| 432 | +- Regression discontinuity: `rdrobust()` |
| 433 | +- Unified `CausalResult` object with `.summary()`, `.plot()`, `.to_latex()`, `.to_docx()`, `.cite()` |
| 434 | + |
| 435 | +--- |
| 436 | + |
376 | 437 | ## About |
377 | 438 |
|
378 | 439 | **StatsPAI Inc.** is the research infrastructure company behind [CoPaper.AI](https://copaper.ai) — the AI co-authoring platform for empirical research, born out of Stanford's [REAP](https://reap.fsi.stanford.edu/) program. |
@@ -405,7 +466,7 @@ pytest |
405 | 466 | author={Wang, Bryce}, |
406 | 467 | year={2025}, |
407 | 468 | url={https://github.com/brycewang-stanford/statspai}, |
408 | | - version={0.3.1} |
| 469 | + version={0.4.0} |
409 | 470 | } |
410 | 471 | ``` |
411 | 472 |
|
|
0 commit comments