Skip to content

StatsPAI v0.2.0

Choose a tag to compare

@brycewang-stanford brycewang-stanford released this 04 Apr 01:23

StatsPAI v0.2.0

The Causal Inference & Econometrics Toolkit for Python.

What's New

Post-Estimation (Stata margins / test / lincom)

  • sp.margins(result, data=df) — Average Marginal Effects with delta-method SE
  • sp.marginsplot(me) — Visualize marginal effects
  • sp.test(result, "x1 = x2") — Wald test for linear restrictions
  • sp.lincom(result, "x1 + x2") — Linear combinations with inference

Publication Tables

  • sp.sumstats(df, vars=[...]) — Summary statistics (Stata tabstat)
  • sp.balance_table(df, treat='T', covariates=[...]) — Balance table for matching/DID
  • sp.tab(df, 'var1', 'var2') — Cross-tabulation with chi² test (Stata tab, chi2)

Export to Word (.docx)

  • sp.outreg2(r1, r2, filename='table.docx') — Multi-model table to Word
  • sp.modelsummary(r1, r2, output='table.docx') — Comparison table to Word
  • result.to_docx('result.docx') — Any single result to Word
  • All tables support: .docx, .xlsx, .tex, .html

Inference

  • sp.wild_cluster_bootstrap() — Wild cluster bootstrap for few-cluster inference
  • sp.aipw() — Augmented Inverse Probability Weighting

Other Improvements

  • PSM now warns about King & Nielsen (2019) bias concerns
  • Updated README with Stata/R comparison table
  • python-docx added as core dependency

Full Module List (v0.2.0)

Category Functions
Regression regress, ivreg, panel
DID did, callaway_santanna
RD rdrobust, rdplot
Matching match (PSM/CEM/Mahalanobis)
Synth synth
ML Causal dml, causal_forest
Other causal_impact, mediate, bartik
Post-estimation margins, test, lincom
Diagnostics oster_bounds, mccrary_test
Tables modelsummary, outreg2, sumstats, balance_table, tab
Inference wild_cluster_bootstrap, aipw

Install

pip install statspai==0.2.0

280 tests | 78% coverage | Python >= 3.9