66[ ![ Tests] ( https://github.com/brycewang-stanford/statspai/workflows/CI%2FCD%20Pipeline/badge.svg )] ( https://github.com/brycewang-stanford/statspai/actions )
77[ ![ PyPI Downloads] ( https://static.pepy.tech/personalized-badge/statspai?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads )] ( https://pepy.tech/projects/statspai )
88
9- StatsPAI is the ** agent-native** Python package for causal inference and applied econometrics. One ` import ` , 280 + 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 the ** agent-native** Python package for causal inference and applied econometrics. One ` import ` , 390 + 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.
1010
1111** Designed for AI agents** : every function returns structured result objects with self-describing schemas (` list_functions() ` , ` describe_function() ` , ` function_schema() ` ), making StatsPAI the first econometrics toolkit purpose-built for LLM-driven research workflows — while remaining fully ergonomic for human researchers.
1212
@@ -45,6 +45,95 @@ It brings R's [Causal Inference Task View](https://cran.r-project.org/web/views/
4545| ` qreg() ` , ` sqreg() ` | Quantile regression | ` qreg ` / ` sqreg ` | ` quantreg::rq() ` |
4646| ` tobit() ` | Censored regression (Tobit) | ` tobit ` | ` censReg::censReg() ` |
4747| ` xtabond() ` | Arellano-Bond dynamic panel GMM | ` xtabond ` | ` plm::pgmm() ` |
48+ | ` glm() ` | Generalized Linear Model (6 families × 8 links) | ` glm ` | ` stats::glm() ` |
49+ | ` logit() ` , ` probit() ` | Binary choice with marginal effects | ` logit ` / ` probit ` | ` stats::glm(family=binomial) ` |
50+ | ` mlogit() ` | Multinomial logit | ` mlogit ` | ` nnet::multinom() ` |
51+ | ` ologit() ` , ` oprobit() ` | Ordered logit / probit | ` ologit ` / ` oprobit ` | ` MASS::polr() ` |
52+ | ` clogit() ` | Conditional logit (McFadden) | ` clogit ` | ` survival::clogit() ` |
53+ | ` poisson() ` , ` nbreg() ` | Count data (Poisson, Negative Binomial) | ` poisson ` / ` nbreg ` | ` MASS::glm.nb() ` |
54+ | ` ppmlhdfe() ` | Pseudo-Poisson MLE for gravity models | ` ppmlhdfe ` | ` fixest::fepois() ` |
55+ | ` zip_model() ` , ` zinb() ` | Zero-inflated Poisson / NegBin | ` zip ` / ` zinb ` | ` pscl::zeroinfl() ` |
56+ | ` hurdle() ` | Hurdle (two-part) model | — | ` pscl::hurdle() ` |
57+ | ` truncreg() ` | Truncated regression (MLE) | ` truncreg ` | ` truncreg::truncreg() ` |
58+ | ` fracreg() ` | Fractional response (Papke-Wooldridge) | ` fracreg ` | — |
59+ | ` betareg() ` | Beta regression | — | ` betareg::betareg() ` |
60+ | ` liml() ` | LIML (robust to weak IV) | ` ivregress liml ` | ` AER::ivreg() ` |
61+ | ` jive() ` | Jackknife IV (many instruments) | — | — |
62+ | ` lasso_iv() ` | LASSO-selected instruments | — | — |
63+ | ` sureg() ` | Seemingly Unrelated Regression | ` sureg ` | ` systemfit::systemfit("SUR") ` |
64+ | ` three_sls() ` | Three-Stage Least Squares | ` reg3 ` | ` systemfit::systemfit("3SLS") ` |
65+ | ` biprobit() ` | Bivariate probit | ` biprobit ` | — |
66+ | ` etregress() ` | Endogenous treatment effects | ` etregress ` | — |
67+ | ` gmm() ` | General GMM (arbitrary moments) | ` gmm ` | ` gmm::gmm() ` |
68+ | ` frontier() ` | Stochastic frontier analysis | ` frontier ` | ` sfa::sfa() ` |
69+
70+ ### Panel Data (Extended)
71+
72+ | Function | Description | Stata equivalent |
73+ | --- | --- | --- |
74+ | ` panel_logit() ` , ` panel_probit() ` | Panel binary (FE conditional / RE / CRE Mundlak) | ` xtlogit ` / ` xtprobit ` |
75+ | ` panel_fgls() ` | FGLS with heteroskedasticity and AR(1) | ` xtgls ` |
76+ | ` interactive_fe() ` | Interactive fixed effects (Bai 2009) | — |
77+ | ` panel_unitroot() ` | Panel unit root (IPS / LLC / Fisher / Hadri) | ` xtunitroot ` |
78+ | ` mixed() ` | Multilevel / mixed effects (HLM) | ` mixed ` |
79+
80+ ### Survival / Duration Analysis
81+
82+ | Function | Description | Stata equivalent |
83+ | --- | --- | --- |
84+ | ` cox() ` | Cox Proportional Hazards | ` stcox ` |
85+ | ` kaplan_meier() ` | Kaplan-Meier survival curves | ` sts graph ` |
86+ | ` survreg() ` | Parametric AFT (Weibull / exponential / log-normal) | ` streg ` |
87+ | ` logrank_test() ` | Log-rank test for group comparison | ` sts test ` |
88+
89+ ### Time Series & Cointegration
90+
91+ | Function | Description | Stata equivalent |
92+ | --- | --- | --- |
93+ | ` var() ` | Vector Autoregression | ` var ` |
94+ | ` granger_causality() ` | Granger causality test | ` vargranger ` |
95+ | ` irf() ` | Impulse response functions | ` irf graph ` |
96+ | ` structural_break() ` | Bai-Perron structural break test | ` estat sbsingle ` |
97+ | ` cusum_test() ` | CUSUM parameter stability test | — |
98+ | ` engle_granger() ` | Engle-Granger cointegration test | — |
99+ | ` johansen() ` | Johansen cointegration (trace / max-eigenvalue) | ` vecrank ` |
100+
101+ ### Nonparametric Methods
102+
103+ | Function | Description | Stata equivalent |
104+ | --- | --- | --- |
105+ | ` lpoly() ` | Local polynomial regression | ` lpoly ` |
106+ | ` kdensity() ` | Kernel density estimation | ` kdensity ` |
107+
108+ ### Experimental Design & RCT Tools
109+
110+ | Function | Description |
111+ | --- | --- |
112+ | ` randomize() ` | Stratified / cluster / block randomization |
113+ | ` balance_check() ` | Covariate balance with normalized differences |
114+ | ` attrition_test() ` | Differential attrition analysis |
115+ | ` attrition_bounds() ` | Lee / Manski bounds under attrition |
116+ | ` optimal_design() ` | Optimal sample size / cluster design |
117+
118+ ### Missing Data
119+
120+ | Function | Description | Stata equivalent |
121+ | --- | --- | --- |
122+ | ` mice() ` | Multiple Imputation by Chained Equations | ` mi impute chained ` |
123+ | ` mi_estimate() ` | Combine estimates via Rubin's rules | ` mi estimate ` |
124+
125+ ### Mendelian Randomization
126+
127+ | Function | Description |
128+ | --- | --- |
129+ | ` mendelian_randomization() ` | IVW + MR-Egger + Weighted Median MR |
130+ | ` mr_plot() ` | Scatter plot with MR regression lines |
131+
132+ ### Structural Estimation
133+
134+ | Function | Description | Reference |
135+ | --- | --- | --- |
136+ | ` blp() ` | BLP random-coefficients demand estimation | Berry, Levinsohn & Pakes (1995) |
48137
49138### Difference-in-Differences
50139
@@ -56,6 +145,10 @@ It brings R's [Causal Inference Task View](https://cran.r-project.org/web/views/
56145| ` sun_abraham() ` | Interaction-weighted event study | Sun & Abraham (2021) |
57146| ` bacon_decomposition() ` | TWFE decomposition diagnostic | Goodman-Bacon (2021) |
58147| ` honest_did() ` | Sensitivity to parallel trends violations | Rambachan & Roth (2023) |
148+ | ` continuous_did() ` | Continuous treatment DID (dose-response) | Callaway, Goodman-Bacon & Sant'Anna (2024) |
149+ | ` did_multiplegt() ` | DID with treatment switching | de Chaisemartin & D'Haultfoeuille (2020) |
150+ | ` did_imputation() ` | Imputation DID estimator | Borusyak, Jaravel & Spiess (2024) |
151+ | ` distributional_te() ` | Distributional treatment effects | Chernozhukov, Fernandez-Val & Melly (2013) |
59152
60153### Regression Discontinuity
61154
@@ -64,6 +157,9 @@ It brings R's [Causal Inference Task View](https://cran.r-project.org/web/views/
64157| ` rdrobust() ` | Sharp/Fuzzy RD with robust bias-corrected inference | Calonico, Cattaneo & Titiunik (2014) |
65158| ` rdplot() ` | RD visualization with binned scatter | — |
66159| ` rddensity() ` | McCrary density manipulation test | McCrary (2008) |
160+ | ` rdmc() ` | Multi-cutoff RD | Cattaneo et al. (2024) |
161+ | ` rdms() ` | Geographic / multi-score RD | Keele & Titiunik (2015) |
162+ | ` rkd() ` | Regression Kink Design | Card et al. (2015) |
67163
68164### Matching & Reweighting
69165
@@ -190,6 +286,17 @@ It brings R's [Causal Inference Task View](https://cran.r-project.org/web/views/
190286| ` vif() ` | Variance Inflation Factor | — |
191287| ` diagnose() ` | General model diagnostics | — |
192288
289+ ### Smart Workflow Engine * (unique to StatsPAI — no other package has these)*
290+
291+ | Function | Description |
292+ | --- | --- |
293+ | ` recommend() ` | Given data + research question → recommends estimators with reasoning, generates workflow, provides ` .run() ` |
294+ | ` compare_estimators() ` | Runs multiple methods (OLS, matching, IPW, DML, ...) on same data, reports agreement diagnostics |
295+ | ` assumption_audit() ` | One-call test of ALL assumptions for any method, with pass/fail/remedy for each |
296+ | ` sensitivity_dashboard() ` | Multi-dimensional sensitivity analysis (sample, outliers, unobservables) with stability grade |
297+ | ` pub_ready() ` | Journal-specific publication readiness checklist (Top 5 Econ, AEJ, RCT) |
298+ | ` replicate() ` | Built-in famous datasets (Card 1995, LaLonde 1986, Lee 2008) with replication guides |
299+
193300### Robustness Analysis * (unique to StatsPAI)*
194301
195302| Function | Description | R/Stata equivalent |
@@ -346,37 +453,77 @@ sp.subgroup_analysis(df, formula="wage ~ education + experience",
346453## API at a Glance
347454
348455``` text
349- 170+ public functions/classes
350-
351- Regression: regress, ivreg, panel, heckman, qreg, sqreg, tobit, xtabond
352- DID: did, did_2x2, callaway_santanna, sun_abraham, bacon_decomposition, honest_did
353- RD: rdrobust, rdplot, rddensity
354- Matching: match, ebalance
355- Synth: synth, sdid
356- ML Causal: dml, causal_forest, deepiv, metalearner, tmle, aipw
456+ 390+ public functions/classes
457+
458+ Regression: regress, ivreg, glm, logit, probit, mlogit, ologit, poisson, nbreg, ppmlhdfe,
459+ tobit, heckman, qreg, truncreg, fracreg, betareg, sureg, three_sls, gmm
460+ IV Advanced: liml, jive, lasso_iv
461+ Panel: panel, panel_logit, panel_probit, panel_fgls, interactive_fe, xtabond, mixed
462+ DID: did, callaway_santanna, sun_abraham, bacon_decomposition, honest_did,
463+ continuous_did, did_multiplegt, did_imputation, stacked_did
464+ RD: rdrobust, rdplot, rddensity, rdmc, rdms, rkd
465+ Matching: match, ebalance, ipw, aipw
466+ Synth: synth, sdid, gsynth, augsynth, staggered_synth, conformal_synth
467+ ML Causal: dml, causal_forest, deepiv, metalearner, tmle
357468Neural: tarnet, cfrnet, dragonnet
358469Discovery: notears, pc_algorithm
359470Policy: policy_tree, policy_value
360- Conformal/Bayes:conformal_cate, bcf
361- Dose-Response: dose_response
362- Multi-Treat: multi_treatment
363- Bounds: lee_bounds, manski_bounds
364- Interference: spillover
365- DTR: g_estimation
366- Bunching: bunching
367- Panel MC: mc_panel
368- Other: causal_impact, mediate, bartik
369- Post-est: margins, marginsplot, test, lincom
370- Diagnostics: oster_bounds, sensemakr, evalue, mccrary_test, hausman_test, het_test, reset_test, vif
371- Robustness: spec_curve, robustness_report, subgroup_analysis
372- Inference: wild_cluster_bootstrap, ri_test
471+ Survival: cox, kaplan_meier, survreg, logrank_test
472+ Time Series: var, granger_causality, irf, structural_break, johansen, engle_granger
473+ Nonparametric: lpoly, kdensity
474+ Experimental: randomize, balance_check, attrition_test, optimal_design
475+ Imputation: mice, mi_estimate
476+ Frontier: frontier (stochastic frontier analysis)
477+ Structural: blp (BLP demand estimation)
478+ MR: mendelian_randomization, mr_ivw, mr_egger, mr_median
479+ Smart Workflow: recommend, compare_estimators, assumption_audit,
480+ sensitivity_dashboard, pub_ready, replicate
373481Output: modelsummary, outreg2, sumstats, balance_table, tab, coefplot, binscatter
374482```
375483
376484---
377485
378486## Release Notes
379487
488+ ### v0.6.0 (2026-04-05) — Complete Econometrics Toolkit + Smart Workflow Engine
489+
490+ ** 30 new modules, 390+ public API, 860+ tests passing, 83K+ lines of code.**
491+
492+ New Regression & GLM:
493+
494+ - ` glm() ` (6 families × 8 links), ` logit() ` , ` probit() ` , ` cloglog() ` , ` mlogit() ` , ` ologit() ` , ` oprobit() ` , ` clogit() `
495+ - ` poisson() ` , ` nbreg() ` , ` ppmlhdfe() ` (gravity model), ` zip_model() ` , ` zinb() ` , ` hurdle() `
496+ - ` truncreg() ` , ` fracreg() ` , ` betareg() ` , ` biprobit() ` , ` etregress() `
497+ - ` liml() ` , ` jive() ` , ` lasso_iv() ` (advanced IV), ` sureg() ` , ` three_sls() ` , ` gmm() ` (general GMM)
498+
499+ New Panel & Multilevel:
500+
501+ - ` panel_logit() ` , ` panel_probit() ` (FE/RE/CRE), ` panel_fgls() ` , ` interactive_fe() ` (Bai 2009)
502+ - ` panel_unitroot() ` (IPS/LLC/Fisher/Hadri), ` mixed() ` (multilevel/HLM)
503+
504+ New Survival: ` cox() ` , ` kaplan_meier() ` , ` survreg() ` , ` logrank_test() `
505+
506+ New Time Series: ` var() ` , ` granger_causality() ` , ` irf() ` , ` structural_break() ` , ` cusum_test() ` , ` engle_granger() ` , ` johansen() `
507+
508+ New Causal: ` continuous_did() ` , ` rdmc() ` , ` rdms() ` (geographic RD), ` distributional_te() ` , ` mendelian_randomization() `
509+
510+ New Design & Data: ` randomize() ` , ` balance_check() ` , ` attrition_test() ` , ` optimal_design() ` , ` mice() ` , ` mi_estimate() `
511+
512+ New Structural: ` blp() ` (BLP demand estimation), ` frontier() ` (stochastic frontier)
513+
514+ Smart Workflow Engine (unique to StatsPAI):
515+
516+ - ` recommend() ` — data + question → estimator recommendation + workflow
517+ - ` compare_estimators() ` — multi-method comparison with agreement diagnostics
518+ - ` assumption_audit() ` — one-call assumption testing with remedies
519+ - ` sensitivity_dashboard() ` — multi-dimensional sensitivity analysis
520+ - ` pub_ready() ` — journal-specific publication readiness checklist
521+ - ` replicate() ` — built-in famous datasets with replication guides
522+
523+ Plot Editor: Font presets redesigned to show actual font names; separate font and size presets for independent per-element control.
524+
525+ ### v0.5.1 (2026-04-04) — Interactive Plot Editor & Agent Enhancements
526+
380527### v0.4.0 (2026-04-05) — Module Architecture Overhaul
381528
382529** Major refactoring and expansion of core modules (+5,800 lines of new code):**
@@ -468,7 +615,7 @@ pytest
468615 author={Wang, Bryce},
469616 year={2025},
470617 url={https://github.com/brycewang-stanford/statspai},
471- version={0.4 .0}
618+ version={0.6 .0}
472619}
473620```
474621
0 commit comments