XE

xiaomihu1992/econometrics-skill

Developer tools
42 stars Quality 55 Trend 28MIT

(计量经济学相关)17 causal-inference estimators (OLS, PSM/IPW, IV/2SLS, DID, RDD) packaged as an AI coding-agent skill with method selection, interpretation templates, and applied workflow.

Overview

— 17 estimators from OLS to RDD, packaged as an AI coding-agent skill. A skill (structured prompt + bundled library) that gives AI coding agents the ability to run defensible causal-inference analyses on user-provided datasets. It covers the standard applied-econometrics toolkit: The skill includes method selection guidance, automatic uploaded-data diagnostics, data preprocessing checklists, covariance/SE mapping tables, known library caveats, interpretation templates, an end-to-end project workflow, diagnostic checklists, result-table helpers, and an advanced applied workflow. - / — reads SKILL.md directly - — see agents/openai.yaml; this is not a standalone OpenAI Agents SDK config - Any framework that can read a Markdown skill definition - GitHub: https://github.com/xiaomihu1992/econometrics-skill - SSH: [email protected]:xiaomihu1992/econometrics-skill.

README

Econometrics Skill

Causal inference for tabular data — 17 estimators from OLS to RDD, packaged as an AI coding-agent skill.

中文说明

What this is

A skill (structured prompt + bundled library) that gives AI coding agents the ability to run defensible causal-inference analyses on user-provided datasets. It covers the standard applied-econometrics toolkit:

Method family Functions Estimand
OLS with controls 1 ATE (under CIA)
Propensity Score (PS, PSM, IPW, AIPW, IPW-RA) 7 ATE / ATT
IV / 2SLS 2 LATE
Difference-in-Differences (static, staggered, event study) 4 ATT / dynamic effects
Regression Discontinuity (sharp, fuzzy, global polynomial) 3 LATE at cutoff

The skill includes method selection guidance, automatic uploaded-data diagnostics, data preprocessing checklists, covariance/SE mapping tables, known library caveats, interpretation templates, an end-to-end project workflow, diagnostic checklists, result-table helpers, and an advanced applied workflow.

Supported agent frameworks

  • Claude Code / OpenClaw — reads SKILL.md directly
  • OpenAI/Codex skill UI metadata — see agents/openai.yaml; this is not a standalone OpenAI Agents SDK config
  • Any framework that can read a Markdown skill definition

Repository

Usage

# Clone the repository
git clone [email protected]:xiaomihu1992/econometrics-skill.git
cd econometrics-skill

# Install Python dependencies
pip install -r requirements.txt

# Run a smoke example
python examples/ols_example.py

For Claude Code or OpenClaw-style skill loading, install or copy the whole econometrics-skill/ folder into the environment’s skill directory, then invoke $econometrics in a causal-inference or uploaded-data diagnostic task. The main entrypoint is SKILL.md; detailed method signatures live in references/method_details.md.

Project structure

econometrics-skill/
├── SKILL.md                              # Main skill definition (English)
├── SKILL.zh-CN.md                        # 中文版 skill 定义
├── lib/
│   ├── econometric_algorithm.py          # 17 causal-inference functions
│   ├── data_preprocess.py                # load_table + uploaded-data diagnostics
│   └── result_tables.py                  # compact model comparison tables
├── references/
│   ├── method_selection.md               # Decision tree for picking the right estimator
│   ├── method_details.md                 # Exact signatures and minimal code per function
│   ├── interpretation.md                 # Reporting templates per method family
│   ├── applied_project_workflow.md       # End-to-end empirical project workflow
│   ├── data_preprocessing_advice.md      # Automatic dataset diagnostics and cleaning advice
│   ├── diagnostic_checklist.md           # Method-specific diagnostic checklist
│   ├── result_tables.md                  # Result table helper guide
│   └── advanced_applied_workflow.md      # Advanced applied workflow
├── examples/
│   ├── ols_example.py                    # OLS: schooling → wages
│   ├── psm_example.py                    # PSM + IPW with bootstrap
│   ├── iv_example.py                     # IV/2SLS: Card-style college → earnings
│   ├── did_example.py                    # Static DID: minimum wage panel
│   ├── did_event_study_example.py        # Staggered DID + event study
│   ├── rdd_example.py                    # Sharp RDD: merit scholarship
│   ├── rdd_fuzzy_example.py              # Fuzzy RDD: housing subsidy
│   ├── data_diagnostic_example.py        # Uploaded-data diagnostics and cleaning advice
│   └── skill_usage_example.zh-CN.md      # 中文使用示例:DID 政策评估
├── agents/
│   └── openai.yaml                       # OpenAI/Codex skill UI metadata
├── requirements.txt
├── LICENSE
└── README.md

Dependencies

  • Python 3.10+
  • numpy, pandas, matplotlib, statsmodels, linearmodels, scipy, openpyxl, xlrd

Practical helpers

  • references/applied_project_workflow.md guides users from question to final report.
  • lib/data_preprocess.py can inspect uploaded CSV/Excel data and produce cleaning advice.
  • references/data_preprocessing_advice.md explains how agents should use the diagnostic output.
  • references/diagnostic_checklist.md gives method-specific checks before causal interpretation.
  • lib/result_tables.py builds compact model comparison tables for statsmodels and linearmodels results.

Known limitations

The library functions have several documented caveats (IV SE bias, non-standard AIPW, event-study lead/lag assumptions, etc.). These are fully documented in SKILL.md § “Known library limitations” and in references/method_details.md. The skill instructs the agent to disclose these to users when relevant.

License

MIT


中文说明

面向表格数据的因果推断 — 17 个估计器,从 OLS 到 RDD,打包为 AI 编程助手的 skill。

这是什么

一个结构化的 skill(提示词 + 算法库),让 AI 编程助手能够在用户提供的数据集上运行可辩护的因果推断分析。涵盖标准应用计量工具箱:

  • OLS:带控制变量的回归
  • 倾向得分方法:PS 构建、可视化、匹配(PSM)、逆概率加权(IPW)、PS 回归、AIPW、IPW-RA
  • 工具变量:IV / 2SLS + 诊断检验
  • 双重差分:静态 DID、交错 DID、事件研究 + 可视化
  • 断点回归:Sharp RDD、Fuzzy RDD(两步法 + 全局多项式)

仓库地址与使用说明

git clone [email protected]:xiaomihu1992/econometrics-skill.git
cd econometrics-skill
pip install -r requirements.txt
python examples/ols_example.py

在 Claude Code 或 OpenClaw 这类支持 skill 的环境中,把整个 econometrics-skill/ 目录安装或复制到 skill 目录,然后在因果推断、数据诊断或政策评估任务中调用 $econometrics。主入口是 SKILL.md,具体函数签名见 references/method_details.md。

快速开始

pip install -r requirements.txt
cd examples
python ols_example.py

深度模式

  • 快速模式:核心三步工作流(识别策略 → 数据检查 → 结果解释)
  • 项目工作流模式:研究问题 → 变量表 → 识别策略 → 诊断 → 稳健性 → 最终报告
  • 数据诊断模式:自动分析上传数据并给出清洗、变量角色和建模准备建议
  • 结果表模式:整理多个模型的系数、标准误、显著性标记和拟合统计量
  • 诊断清单模式:在因果解释前检查各方法的关键风险
  • 高级应用模式:高级研究流程(estimand → 识别备忘录 → 诊断 → 稳健性 → 异质性)

详细中文说明见 SKILL.zh-CN.md,使用示例见 examples/skill_usage_example.zh-CN.md。

View the full README on GitHub

Recommended Tools

Try a different keyword or remove a filter.

Install

npx skillfish add xiaomihu1992/econometrics-skill
New to MCP? Start with the mcpskill.org guide →