SkillAgentSearch skills...

StatsPAI_skill

Use when the user asks to run a full empirical / causal analysis in Python — by default in the style of an applied economics paper (AER / QJE / JPE / ReStud / AEJ) with DID / RD / IV / SCM / DML / matching, written-out estimating equation + identifying assumption, Table 1 / Table 2 / event-study fig…

Install / Use

npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill 00-Full-empirical-analysis-skill_StatsPAI

Installs into whichever agent you are using.

About this skill
📄

SKILL.md

Installable skill definition

Quality Score

86/100

Supported Platforms

Universal

Our assessment of StatsPAI_skill

StatsPAI_skill scores 86/100 on our quality scale, 2339th of 4,698 Development & Engineering skills we index (top 50%).

Its SKILL.md is 142 KB long, well organised into 325 sections with 83 code examples: long enough that it reads more like full documentation than a focused instruction file, which agents can find harder to follow.

With 4,360 GitHub stars, it is one of the more widely adopted skills in the catalogue.

Substance
21/30
Structure
20/20
Description
15/15
Adoption
15/20
Freshness
15/15

Maintenance, license and trust

  • The repository was last updated about 2 months ago, so StatsPAI_skill is actively maintained.
  • Our last check on 2026-11-03 found the source still online.
  • No license is declared. By default that means all rights are reserved: you can read it, but reusing or redistributing it is not clearly permitted. Ask the author before building on it commercially.
  • Its trust signals score 88/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.

Safety scan

No issues found

Our scan of the first 100 KB of the file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.

AI review by kimi-k2.7-code on 2026-09-29. Automated pattern scan on 2026-09-29. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.

StatsPAI_skill compared with similar skills

All 4 of these similar skills score higher than StatsPAI_skill; compare them before choosing.

SkillScoreStarsUpdatedFormat
StatsPAI_skill (this skill)by brycewang-stanford864.4k54d agoSKILL.md
taste-skillby Leonxlnx100116.8k8d agoCLAUDE.md
Agent-Reachby Panniantong100112.3k8d agoCLAUDE.md
headroomby headroomlabs-ai10079.8ktodayCLAUDE.md
ai-job-searchby ai-job-search-dev10072.1ktodayCLAUDE.md

Frequently asked questions

How do I install StatsPAI_skill?
Run npx skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill StatsPAI_skill. The install tabs above show the steps for each supported agent.
Which AI agents does StatsPAI_skill work with?
It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
Is StatsPAI_skill safe to use?
Our scan of the first 100 KB of the file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It declares no license and scores 88/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
Is StatsPAI_skill still maintained?
The repository was last updated about 2 months ago, so StatsPAI_skill is actively maintained.

name: StatsPAI_skill description: Use when the user asks to run a full empirical / causal analysis in Python — by default in the style of an applied economics paper (AER / QJE / JPE / ReStud / AEJ) with DID / RD / IV / SCM / DML / matching, written-out estimating equation + identifying assumption, Table 1 / Table 2 / event-study figure / robustness gauntlet — OR in epidemiology / public health style (target-trial emulation, IPTW + g-formula + TMLE triplet, Mendelian randomization, KM/AFT survival, E-value sensitivity, STROBE/TRIPOD reporting) — OR in ML causal inference style (DML, S/T/X/R/DR meta-learners, causal forest, Dragonnet/TARNet/CEVAE, BCF, CATE distribution, policy learning, conformal causal, fairness audit, causal discovery) — OR in distributional / gap-decomposition style (Oaxaca–Blinder sp.oaxaca, Kitagawa sp.kitagawa_decompose, DiNardo–Fortin–Lemieux sp.dfl_decompose, Gelbach sp.gelbach, Fairlie sp.fairlie, RIF / FFL sp.rif_decomposition, all reachable through the sp.decompose dispatcher). Also covers exporting multi-column regression tables to Word / Excel / LaTeX (Stata outreg2 / esttab / R modelsummary equivalent) and bundling an entire replication appendix into one .docx / .xlsx / .tex file. Triggers on keywords "StatsPAI", "statspai", "AER empirical analysis", "applied micro pipeline", "Table 1 balance", "event study", "first-stage F", "Oster bound", "honest_did", "spec_curve", "callaway_santanna", "dragonnet", "text as treatment", "outreg2 in Python", "regression table to Word/Excel", "sp.regtable", "sp.collect", "sp.paper_tables", "sp.feols", "summary_col", "modelsummary", "AER style table", "QJE style table", "epidemiology pipeline", "target trial emulation", "g-formula", "IPTW", "TMLE", "Mendelian randomization", "STROBE", "TRIPOD", "公共健康", "流行病学", "DML", "double machine learning", "causal forest", "meta-learner", "CATE", "conformal causal", "policy learning", "因果机器学习", "ML causal", "decomposition", "Oaxaca-Blinder", "Kitagawa", "DiNardo-Fortin-Lemieux", "DFL", "Gelbach", "RIF decomposition", "wage gap decomposition", "sp.decompose", "sp.oaxaca". triggers:

  • causal inference in python
  • applied microeconomics pipeline
  • AER empirical analysis
  • QJE style robustness
  • DID IV RD SCM
  • callaway_santanna
  • synthetic control
  • double machine learning
  • causal forest
  • event study plot
  • first stage F-statistic
  • Oster bound
  • honest_did
  • spec_curve
  • estimand-first DSL
  • LLM-assisted DAG discovery
  • Oaxaca-Blinder decomposition
  • Kitagawa decomposition
  • DiNardo-Fortin-Lemieux decomposition
  • Gelbach decomposition
  • RIF regression decomposition
  • wage gap decomposition
  • text as treatment
  • export regression table to Word
  • export regression table to Excel
  • regression table docx
  • regression table xlsx
  • outreg2 in Python
  • summary_col equivalent
  • modelsummary equivalent
  • AER house style table
  • QJE house style table
  • journal template regression
  • Stata collect equivalent
  • replication bundle
  • sp.regtable
  • sp.collect
  • sp.paper_tables
  • sp.feols
  • sp.cite
  • high-dim fixed effects
  • two-way clustering
  • StatsPAI
  • statspai
  • fmt auto regression table
  • magnitude-adaptive coefficient formatting
  • mixed magnitude coefficients
  • sumstats by_labels
  • Control Treated auto labels
  • epidemiology pipeline
  • public health causal inference
  • target trial emulation
  • g-formula
  • IPTW marginal structural model
  • TMLE doubly robust
  • HAL-TMLE
  • Mendelian randomization
  • MR-Egger weighted median
  • STROBE TRIPOD reporting
  • E-value sensitivity
  • Kaplan-Meier AFT survival
  • 流行病学
  • 公共健康
  • ML causal inference
  • double machine learning DML
  • meta-learner S T X R DR
  • causal forest GRF
  • Dragonnet TARNet CEVAE
  • Bayesian causal forest BCF
  • CATE distribution
  • policy tree
  • off-policy evaluation
  • conformal causal prediction
  • fairness audit
  • causal discovery PC NOTEARS
  • 因果机器学习

StatsPAI: Agent-Native Causal Inference & AER-Style Empirical Workflow

StatsPAI is a validation-tiered Python package for causal inference and applied econometrics: one import statspai as sp, 1,100+ registered functions behind a self-describing API, and mature estimator result objects that commonly export to LaTeX / Word / Excel / BibTeX.

This skill drives StatsPAI through the canonical pipeline of an applied AER empirical paper. Each step emits a paper-ready artifact (Table 1, event-study figure, Table 2 main results, robustness panel, replication stamp).

  • Source: https://github.com/brycewang-stanford/StatsPAI
  • Install: pip install "statspai[fixest,plotting]" (API surface re-validated against statspai 1.19.0 — every sp.* reference, signature, and result-object attribute claim in this skill is checked by validate_api_claims.py in this folder). The bare pip install statspai is not enough for the default pipeline — see the dependency matrix below.
  • Paper: Wang & Rozelle (2026), Journal of Open Source Software 11(125), 10604, https://doi.org/10.21105/joss.10604; JSS materials in Paper-JSS/README.md and docs/jss_source_audit_dossier.md

Install the right extras or the documented calls will raise ImportError. Several core functions live behind optional dependency groups (verified from pyproject.toml):

| You use… | Needs extra | Install | Symptom if missing | |---|---|---|---| | sp.feols / sp.fepois / sp.feglm (high-dim FE — the default for any y ~ x \| fe regression) | fixest (pyfixest) | pip install "statspai[fixest]" | ImportError: pyfixest is required … | | Any figure (sp.coefplot, sp.binscatter, event-study/RD/SCM plots, .plot()) | plotting (matplotlib/seaborn) | pip install "statspai[plotting]" | ImportError on first plot | | sp.dragonnet / sp.tarnet / sp.cfrnet / sp.cevae (neural causal) | neural (torch) | pip install "statspai[neural]" | ImportError: PyTorch is required … | | sp.causal_text.* (text-as-treatment) | text (sentence-transformers) | pip install "statspai[text]" | ImportError on embed |

A one-shot install covering the whole skill: pip install "statspai[fixest,plotting,neural,text]". sp.regtable / sp.collect / Word+Excel+LaTeX export, sp.regress, IV, RD, DID (callaway_santanna), matching, DML, meta-learners, causal forest, BCF, TMLE, and the epi stack work on the base install.

Verified skeleton (copy, then swap in your columns)

This minimal pipeline runs start-to-finish against statspai 1.19.0 (every call below was executed). It is the golden path — adapt column names / design, keep the call shapes and the unpack-then-save figure idiom. The full playbook (§−1 → §8) expands each step.

import numpy as np, pandas as pd, statspai as sp
# df has: wage, training(0/1), worker_id, firm_id, year, first_treat_year, age, edu, tenure, ...

# §1 Table 1 → Word/Excel/LaTeX
mc = sp.mean_comparison(df, ["age","edu","tenure"], group="training", test="ttest",
                        title="Table 1. Summary statistics")
mc.to_word("tables/table1.docx"); mc.to_excel("tables/table1.xlsx")

# §2 Estimand-first plan (freeze BEFORE estimating)
q = sp.causal_question(treatment="training", outcome="wage", data=df, estimand="ATT",
                       design="did", time_structure="panel", time="year", id="worker_id",
                       covariates=["age","edu","tenure"])
plan = q.identify(); print(plan.summary())

# §3 Identification figure — from a CS/SA result (NOT event_study()); plotters return (fig, ax)
cs = sp.callaway_santanna(df, y="wage", g="first_treat_year", t="year", i="worker_id", x=["age","edu"])
fig, ax = sp.enhanced_event_study_plot(cs, shade_pre=True); fig.savefig("figures/fig2a.png", dpi=300)

# §4 Main table — mix sp.regress (no FE) + sp.feols (HDFE, needs statspai[fixest]) in ONE regtable
M1 = sp.regress("wage ~ training", df, cluster="firm_id")
M2 = sp.feols("wage ~ training + age + edu + tenure | industry + year", df, vcov={"CRV1":"firm_id"})
rt = sp.regtable(M1, M2, template="aer", coef_labels={"training":"Job training"},
                 model_labels=["(1) OLS","(2) FE"], stats=["N","R2","Cluster","FE"],
                 title="Table 2. Effect of training on wages")
rt.to_word("tables/table2.docx"); rt.to_excel("tables/table2.xlsx")
open("tables/table2.tex","w").write(rt.to_latex())

# §5 Heterogeneity — per-row CATE at result.model_info["cate"] (there is NO .cate_estimates)
ml = sp.metalearner(df, y="wage", treat="training", covariates=["age","edu","tenure"], learner="dr")
fig, ax = sp.cate_plot(ml, kind="hist"); fig.savefig("figures/fig4.png", dpi=300)

# §7 Robustness — Oster + E-value + honest-DID sensitivity figure
sp.oster_bounds(data=df, y="wage", treat="training", controls=["age","edu","tenure"], r_max=1.3)
sp.evalue(estimate=M2.params["training"], ci=tuple(M2.conf_int().loc["training"]), measure="RR")
fig, ax = sp.sensitivity_plot(sp.honest_did(cs, method="smoothness"),
                              original_estimate=cs.estimate, original_ci=cs.ci)
fig.savefig("figures/fig6.png", dpi=300)

# §8 One-file replication bundle (Word/Excel/LaTeX/Markdown from one source)
c = sp.collect("Replication", template="aer")
c.add_summary(df, vars=["wage","age","edu","tenure"], stats=["mean","sd","n"], title="Table 1")
c.add_regression(M1, M2, model_labels=["(1)","(2)"], stats=["N","R2"], title="Table 2")
for ext in ("docx","xlsx","tex","md"): c.save(f"replication/paper.{ext}")

Epi (§A) and ML-causal (§B) reuse this exact scaffolding — only the §4 estimator stack changes (TMLE/g-formula/MR for epi; DML/meta-learner/causal-forest for ML), and every estimator still returns a result that drops into sp.regtable / sp.collect.

Why for Agents

  1. Self-describing: sp.list_functions() / sp.describe_function(name) / sp.function_schema(name) — registered symbols are discoverable without doc lookup.
  2. Structured results: mature estimators return result objects with methods such as .summary(), .plot(), .diagnostics, .to_latex(), .to_word(), .cite() when supported.
  3. One import, full pipeline: data contract → Table 1 → estimand-first DSL → identification graphs → main table → heterogeneity → mechanisms → robustness → replication package.
  4. Estimand-first: sp.causal_question(...).identify() forces the "DID vs RD vs IV?" decision before estimation, with the identifying assumption written down — the way a referee expects to read it.

SkillOpt-derived operating loop (read before the playbook)

SkillOpt's useful lesson for this skill is procedural, not cosmetic: a skill is a bounded decision policy that should improve from rollout evidence while preserving verified behavior. Treat every StatsPAI request as a mini rollout:

  1. Route the mode first: choose Default/AER, Mode A/epi, Mode B/ML-causal, or a narrow export-only path from the user's words. Do not run the full paper pipeline when the request is only "make Table 1" or "export this regression".
  2. Freeze the contract before estimating: name y, treatment/exposure, unit/time ids, estimand, design, required artifacts, and install extras. If any field is missing, infer only when the column names make the choice obvious; otherwise produce a short blocking checklist instead of hallucinating columns.
  3. Start from the smallest verified call shape: prefer the skeleton and the relevant section-specific snippet over ad hoc API guesses. For an unfamiliar function, call sp.describe_function(name) / sp.function_schema(name) before writing code.
  4. Widen one block at a time: data contract → plan → diagnostic figure → main estimate → robustness/export. After each block, read warnings and object attributes before passing the result downstream.
  5. Gate the answer on artifacts, not intentions: final responses should list

Truncated for display — read the full file on GitHub.

Related Skills

View on GitHub
GitHub Stars4.4k
CategoryDevelopment
Updated1mo ago
Forks527

Languages

Stata

Trust signals

88/100

From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.

1 medium
StatsPAI_skill — Universal Skill: Install & Safety Check | SkillAgent