statspai-analysis

statspai-analysis is a skill for Claude Code, Codex from brycewang-stanford/StatsPAI. It costs 271 tokens per session (2,799 once invoked), scanned A, original, MIT.

A Python workflow for empirical and causal analysis, using methods such as difference-in-differences, regression discontinuity, instrumental variables, matching, and synthetic controls. It produces analysis results and exports tables and figures for papers.

In plain words
What is it for?
Use it to analyse experimental or observational data, build event-study figures, create research tables, and export results to Word, Excel, LaTeX, or BibTeX.
Why use it?
It reduces the work of choosing an analysis method, checking its assumptions, running robustness checks, and preparing results in common research formats.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to analyse experimental or observational data, build event-study figures, create research tables, and export results to Word, Excel, LaTeX, or BibTeX.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/brycewang-stanford/statspai/_skill
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add brycewang-stanford/StatsPAI --skill _skill
Clone the repo
git clone --depth 1 https://github.com/brycewang-stanford/StatsPAI

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for statspai-analysis

README.md
[![agentmods](https://agentmods.dev/badge/skills/brycewang-stanford/statspai/_skill/github.svg)](https://agentmods.dev/skills/brycewang-stanford/statspai/_skill)
Your own site
<a href="https://agentmods.dev/skills/brycewang-stanford/statspai/_skill"><img src="https://agentmods.dev/badge/skills/brycewang-stanford/statspai/_skill/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for statspai-analysis

Your own site · 80×15
<a href="https://agentmods.dev/skills/brycewang-stanford/statspai/_skill"><img src="https://agentmods.dev/badge/skills/brycewang-stanford/statspai/_skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 271 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,799 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00271 $0.02799
Opus 5.5 $0.00108 $0.01120
Sonnet 5.5 $0.00054 $0.00560
Haiku 4.5 $0.00027 $0.00280

Measured 2d ago against content hash 98652fd173b2, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

statspai-analysis scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (validate_api_claims.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/statspai/agent/_skill/SKILL.md · 159 lines

How it starts

The opening of the file, as written. The whole thing — 159 lines — stays where its author put it; the contents beside it link to each section on GitHub.

StatsPAI: agent-native causal inference, paper-ready

StatsPAI is one import statspai as sp over 1,500+ registered functions for causal inference and applied econometrics, numerically aligned with Stata / R reference implementations, with self-describing schemas and result objects that export to LaTeX / Word / Excel / BibTeX. This skill drives it through the canonical pipeline of an applied empirical paper, in one of three modes (default applied econ; epidemiology; ML-causal), and leaves paper-ready artifacts on disk at every step.

  • Source: https://github.com/brycewang-stanford/StatsPAI
  • Install: pip install "statspai[fixest,plotting]" (default pipeline); add neural for Dragonnet / TARNet / CEVAE, text for text-as-treatment. The bare install cannot run sp.feols (any y ~ x | fe regression) or make figures — see references/operating-loop.md for the extras matrix.
  • Verified: validate_api_claims.py checks this skill against the installed package (statspai skill validate). Every sp.* name resolves, every sp.*(...) call in a code block binds to the real signature (for a function that takes **kwargs, to its agent schema or forwarding target), and the result attributes on the gate's smoke-fit list exist. With --run the pipeline files are also executed end to end on synthetic data, which is what catches a call that binds but is rejected at run time. There is no version stamp to go stale.
  • Is this copy current? An installed skill is a plain copy and does not follow pip install -U statspai. statspai skill status compares it with the skill packaged in the installed version; if it reports stale, say so and suggest statspai skill install --force before relying on a call shape written here.
  • Paper: Wang & Rozelle (2026), Journal of Open Source Software 11(125), 10604, https://doi.org/10.21105/joss.10604.

Operating loop (every request)

  1. Route the mode first from the user's words — default applied econ, Mode A epi, Mode B ML-causal, or an export-only path. Do not run the whole paper pipeline for "make Table 1" or "export this regression". A request for one estimate, one check or one table takes the short path in references/quick-path.md.
  2. Freeze the contract before estimating: y, treatment / exposure, unit / time ids, estimand, design, required artifacts, install extras. Infer a missing field only when the column names make it obvious; otherwise return a short blocking checklist instead of inventing columns.
  3. Pick the estimator with the tables, not from memory: sp.route('did', design='staggered', timing_random='no', covariates='none') (also iv, rd, matching, ml_causal, qte, dynamic_panel) returns the registered call, an example, why, and the assumptions it adds; sp.decision_guide(family) lists the questions. sp.recommend(df, ...) routes from the data itself.
  4. Start from the smallest verified call shape: the skeleton in references/verified-skeleton.md, then the section snippet. For anything unfamiliar, sp.describe_function(name) / sp.function_schema(name) before writing code; sp.search_functions("weak instrument robust CI") to find the name.
  5. Widen one block at a time: data contract → plan → diagnostic figure → main estimate → robustness / export. After each block read the result's violations(), next_steps(), degradations and model_info before passing it downstream.
  6. Gate the answer on artifacts: the final message lists the files produced, the identifying assumption, the estimator class, and any failed or skipped gate. Never say "paper-ready" when an export or a required diagnostic did not actually run.
  7. Turn failures into bounded corrections: a StatsPAIError carries code, recovery_hint, diagnostics and alternative_functions; fix the smallest wrong rule and continue from the last verified artifact.

Read the full file on GitHub · 159 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago Changed · +12 lines · +30 tokens per session 98652fd173b2
  2. 13d ago Changed · +7 lines 6db351d9ff9c
  3. 17d ago First seen · 140 lines · 241 tokens per session scan A 11f41d649b4c

Subscribe to this mod's changes

statspai-analysis is a skill published in the GitHub repository brycewang-stanford/StatsPAI (340 stars, last pushed today), licensed MIT. It adds 271 tokens to every session and 2,799 once invoked, about $0.0011 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-29.

Related

Other skills, from other repositories