haipingxu/social-science-claude-scholar/causal-inference-analysis
Claude Code and agent skill by haipingxu/social-science-claude-scholar
- community
Checking that the SKILL.md file is still in the repository.
Use when the user asks to "implement DID", "run difference-in-differences", "set up IV regression", "instrumental variables", "run RDD", "regression discontinuity", "synthetic control", "staggered treatment", "Callaway-Sant'Anna", "Sun-Abraham", "event study", "parallel trends test", "first stage", "Bartik instrument", "shift-share IV", "write Stata regression code", "convert Stata to Python", "use statsmodels", "use linearmodels", "use econml", "panel data regression", "fixed effects", "two-wa…
Install
npx vskill@latest install haipingxu/social-science-claude-scholar/causal-inference-analysisSKILL.md
Causal Inference Analysis
Practical implementation guide for DID, IV, RDD, and Synthetic Control in Python and Stata. Covers setup, estimation, assumption testing, and output generation.
Quick Reference
| Method | Python Library | Stata Command | |
|---|---|---|---|
| Two-way FE / DID | linearmodels.PanelOLS | reghdfe | |
| Staggered DID (CS) | csdid / pyfixest | csdid (ado) | |
| Staggered DID (SA) | pyfixest | eventstudyinteract | |
| IV / 2SLS | linearmodels.IV2SLS | ivregress 2sls / ivreg2 | |
| Shift-share IV | manual + linearmodels | ssiv (ado) | |
| RDD | rdd / rdrobust (Python) | rdrobust, rddensity | |
| Synthetic Control | synth_runner / pysynth | synth | |
| Double-LASSO | doubleml | pdslasso |
Method 1: Difference-in-Differences
Standard 2×2 DID (Python)
Event Study / Dynamic DID (Python)
Callaway-Sant'Anna (staggered, Python)
Pre-trend Test Interpretation
- Coefficients at t = −1, −2, ..., −k should be near zero and statistically insignificant
- Report the joint F-test for pre-period coefficients
- If pre-trends detected: consider controlling for unit-specific linear trends or using CS/SA estimators
Method 2: Instrumental Variables
Basic 2SLS (Python)
Shift-Share (Bartik) IV
Key diagnostics to report:
- Kleibergen-Paap F (for clustered SE) — not Cragg-Donald
- Stock-Yogo critical values for size distortion
- First-stage coefficient on instrument with SE
Method 3: Regression Discontinuity
Sharp RDD (Python)
RDD Robustness Checklist
Method 4: Synthetic Control
Basic Synthetic Control (Python)
Placebo tests:
Stata → Python Translation
Common Stata patterns and their Python equivalents:
| Stata | Python | |
|---|---|---|
reghdfe y x, absorb(unit year) cluster(state) | PanelOLS + cov_type='clustered' | |
ivregress 2sls y x (endog = iv), cluster(state) | IV2SLS with clustered SE | |
rdrobust y x, c(0) kernel(triangular) | rdrobust(y, x, c=0, kernel='triangular') | |
estout / esttab | stargazer or modelsummary (Python) | |
coefplot | pyfixest.iplot() or manual matplotlib |
See references/stata-to-python.md for detailed translation guide.
Output Generation
Regression Table (LaTeX)
Event Study Plot
Package Installation
Reference Resources
- `references/stata-to-python.md` — Comprehensive Stata→Python translation with code
- `references/identification-tests.md` — Detailed assumption test protocols (pre-trends, density, first stage)
- `references/output-templates.md` — LaTeX table templates, event study plot templates
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/causal-inference-analysis/SKILL.md
Popularity
- Repository stars
- 3
- Repository forks
- 1
- 7-day trend score
- 7
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 1 Apr 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/haipingxu/social-science-claude-scholar/causal-inference-analysis)