brycewang-stanford/Auto-Empirical-Research-Skills / skills/10-Jill0099-causal-inference-mixtape
causal-inference-mixtape
VerifiedThis skill should be used when the user asks to "implement a DiD regression", "write a causal inference pipeline", "set up an event study", "implement instrumental variables", "run a regression discontinuity design", "build a synthetic control model", "implement propensity score matching", "write parallel trends test", "implement Bacon decomposition", or needs code templates for causal inference methods in Python, R, or Stata. Based on Scott Cunningham's Causal Inference: The Mixtape.
| File | Kind | Size |
|---|---|---|
| README-original.md | markdown | 4.6 KB |
| SKILL.md | skill md | 5.9 KB |
| prompts/01-implement-method.md | markdown | 2.6 KB |
| prompts/02-robustness-checks.md | markdown | 3.4 KB |
| references/method-patterns.md | markdown | 12.5 KB |
| references/r-stata-comparison.md | markdown | 4.5 KB |
prompts/01-implement-method.md
View on GitHub# Prompt 1: Implement a Causal Inference Method
Copy and paste the prompt below into Claude with your details filled in.
---
```
You are an expert econometrician implementing causal inference methods.
Implement a complete [METHOD] analysis pipeline in [LANGUAGE: Python / R / Stata].
Requirements:
1. Data preparation (variable creation, sample restrictions)
2. Main estimation with correct standard errors
3. Key diagnostic / robustness check
4. Publication-ready output (coefficient table or plot)
Method-specific requirements:
- DiD: Include parallel trends event study plot. Cluster SE at [level]. Report DiD coefficient with baseline mean for economic magnitude.
- RDD: Include McCrary density test, bandwidth robustness (half/double), polynomial robustness. Report local linear estimate.
- IV: Report first-stage F-statistic. Defend exclusion restriction. Report Wu-Hausman test.
- Synthetic Control: Pre-treatment fit (RMSPE), placebo distribution, gaps plot.
- Matching/IPW: Covariate balance table before and after. Trimming at [0.1, 0.9].
- Event Study: Dynamic coefficients plot with 95% CI. Reference period = t-1.
My details:
- Method: [e.g., Difference-in-Differences]
- Language: [e.g., Python]
- Outcome variable: [e.g., firm_investment]
- Treatment variable: [e.g., reform_exposure]
- Treatment timing: [e.g., 2014 for all treated units / staggered]
- Key controls: [e.g., firm size, leverage, ROA]
- Fixed effects: [e.g., firm + year]
- Clustering level: [e.g., firm]
- Data format: [e.g., panel, entity_id + year columns]
- Sample size: [e.g., ~50,000 firm-years]
- Key concern: [e.g., contemporaneous policies]
[PASTE SAMPLE OF YOUR DATA STRUCTURE OR DESCRIBE COLUMNS]
```
---
## Method-Specific Variants
### For Staggered DiD
```
Additional requirement: Treatment timing varies across units.
- Use [Callaway & Sant'Anna / Sun & Abraham / Bacon decomposition] to address TWFE bias.
- Show that standard TWFE is potentially biased.
- Report group-time ATTs and aggregated dynamic effects.
My staggered details:
- Treatment cohorts: [e.g., 2010, 2012, 2014, 2016]
- Never-treated group exists: [yes/no]
- Preferred estimator: [e.g., Callaway & Sant'Anna]
```
### For Fuzzy RDD
```
Additional requirement: Treatment assignment is not sharp at the cutoff.
- Implement fuzzy RDD as IV where crossing the cutoff instruments for treatment.
- Report both reduced-form and 2SLS estimates.
- Show first-stage discontinuity in treatment probability.
My fuzzy RDD details:
- Running variable: [e.g., vote share]
- Cutoff: [e.g., 50%]
- Treatment: [e.g., policy implementation — not all units above cutoff comply]
- Compliance rate above cutoff: [e.g., ~75%]
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |