# StatsPAI_skill

Wires the statspai Python package into a session: descriptives, estimator choice, treatment-effect estimation and post-estimation checks.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf (Devin Desktop), Claude.ai · ★ 240 repo stars
- Author: franklee16
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/franklee16/academic-research-skills/tree/HEAD/data-analysis/StatsPAI_skill/SKILL.md
- Updated: 2026-09-18
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/statspai-skill

## What it does

The skill gives a Claude agent a single entry point to `statspai`: one `import statspai as sp`, 900+ functions behind a shared API. Work starts at descriptives and balance tables (`sp.sumstats`, `sp.balance_table`), passes through the research-question DSL `sp.causal_question` and ends at estimation via `sp.causal` or a named estimator. Classical methods cover OLS, IV, DID including staggered adoption, RDD, PSM and SCM; the ML side has DML, Causal Forest, Meta-Learners and TMLE.

Function discovery is built in. `sp.list_functions()`, `sp.describe_function("did")` and `sp.function_schema("rdrobust")` return schemas the model can read without opening docs. Estimators hand back a result object with `.summary()`, `.plot()`, `.to_latex()`, `.to_word()`, `.to_excel()`, `.cite()` plus a diagnostics dict that agent logic can branch on. Separate steps handle DAG proposals (`sp.llm_dag_propose`, `sp.llm_dag_validate`), text as treatment (`sp.causal_text`) and post-estimation checks (`sp.diagnose`, `sp.spec_curve`, `sp.honest_did`).

Cleaning stays out of scope. Missing values, type coercion and merges belong in pandas before the first `sp.*` call. Skip that and an estimator either raises or drops rows silently, which is your bug rather than the skill's. Draft writing through `sp.paper()` is excluded too; the flow stops at diagnostics and hands the result back.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add franklee16/academic-research-skills --skill statspai_skill -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/StatsPAI_skill/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/StatsPAI_skill/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add franklee16/academic-research-skills --skill statspai_skill -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/StatsPAI_skill/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add franklee16/academic-research-skills --skill statspai_skill -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/StatsPAI_skill/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install franklee16/academic-research-skills data-analysis/StatsPAI_skill/SKILL.md
```

2. **Manually: put the files in place**
- File: `.github/skills/StatsPAI_skill/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add franklee16/academic-research-skills --skill statspai_skill -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/franklee16/academic-research-skills --path data-analysis/StatsPAI_skill
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/StatsPAI_skill/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/franklee16/academic-research-skills/tree/HEAD/data-analysis/StatsPAI_skill/SKILL.md

## When to use it
- Estimate a training effect on wages with panel DID
- Pick between DID, RDD and IV for a stated estimand
- Build a covariate balance table before estimation
- Stress-test a fitted model with a specification curve and HonestDiD
- Locate the right package function from its schema

## Example prompts
- Run a DID estimate of the training effect on wages, panel keyed on `worker_id` and `year`
- Use `sp.causal_question` to decide between DID, RDD and IV on this data
- Propose a DAG with `sp.llm_dag_propose`, then run `sp.diagnose` on the model

## Similar
- [StatsPAI](https://affpapa.org/en/nevibecode/mcp/statspai.md) — MCP server · ★ 378 repo stars
- [Causal Inference](https://affpapa.org/en/nevibecode/skills/causal-inference.md) — skill · 544 installs
- [statsmodels](https://affpapa.org/en/nevibecode/skills/k-dense-ai-statsmodels.md) — skill · 2400 installs
- [everyday-causal-skills](https://affpapa.org/en/nevibecode/plugins/everyday-causal-skills.md) — plugin · ★ 84 repo stars
- [r-econometrics](https://affpapa.org/en/nevibecode/skills/r-econometrics.md) — skill · 340 installs
- [simulation-study](https://affpapa.org/en/nevibecode/skills/simulation-study.md) — skill · ★ 1729 repo stars

From the same set: [franklee16/academic-research-skills](https://affpapa.org/en/nevibecode/by/franklee16/academic-research-skills.md) — 98 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
