One-click install
npx skills add https://github.com/Yuuqq/claude-social-science-skills --skill causal-inference-yuuqq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: causal-inference
Source: https://github.com/Yuuqq/claude-social-science-skills/tree/main/social-science-skills/causal-inference
Command: npx skills add https://github.com/Yuuqq/claude-social-science-skills --skill causal-inference-yuuqq

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires numpy, pandas, pyfixest, econml, scikit-learn, linearmodels, statsmodels, rdrobust, pysyncon, rdd, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

Causal inference turns observed data into defensible estimates of causal effects rather than misleading correlations.

Core Features & Use Cases

  • Difference-in-Differences (DiD) for policy evaluation with parallel-trends diagnostics and robustness checks, including staggered adoption workflows.
  • Regression Discontinuity (RDD) for sharp and fuzzy designs with density tests, bandwidth/polynomial sensitivity, and donut approaches.
  • Instrumental Variables (IV/2SLS) for endogeneity settings with weak-instrument diagnostics and overidentification checks.
  • Propensity Score Matching (PSM) to estimate treatment effects under selection on observables, with balance/overlap diagnostics.
  • Synthetic Control (SCM) for case studies with one treated unit and a donor pool, including placebo and leave-one-out robustness.
  • Double Machine Learning (DML) for heterogeneous effects using ML-driven nuisance estimation with doubly robust structure.
  • Use case examples: test DiD parallel trends using event studies; design an RDD around a cutoff; evaluate a policy using SCM with donor fit; estimate ATE/CATE using DML when many controls exist.

Quick Start

Ask: “Using the attached dataset, estimate the causal effect of treatment on outcome with an identification strategy appropriate to the data structure (DiD/RDD/IV/PSM/SCM/DML), then produce assumptions, diagnostics (placebo/parallel trends/density/first-stage fit), and a robustness plan.”

Frequently Asked Questions about causal-inference

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I estimate causal effects from observational data using difference-in-differences with staggered timing?

To estimate causal effects using difference-in-differences, apply staggered adoption workflows with parallel-trends diagnostics and robustness checks. This approach uses pyfixest to compare changes over time between treated and untreated groups in observational data.

What's the best way to set up a regression discontinuity design around a cutoff?

Setting up a regression discontinuity design involves analyzing sharp or fuzzy cutoffs using rdrobust. The workflow includes running density tests, evaluating bandwidth and polynomial sensitivity, and applying donut approaches to ensure credible causal effect estimates.

Can I use instrumental variables with 2SLS to handle endogeneity in Python?

Instrumental variables with 2SLS handle endogeneity in Python using linearmodels. The workflow requires implementing weak-instrument diagnostics and overidentification checks to validate the causal estimates derived from your observational data.

How does double machine learning estimate heterogeneous treatment effects with high-dimensional controls?

Double machine learning estimates heterogeneous treatment effects by using ML-driven nuisance estimation within a doubly robust structure. Supported by econml, it isolates the causal effect of treatment when many high-dimensional controls exist in the dataset.

When do I need synthetic control methods for policy evaluation case studies?

Synthetic control methods are needed for policy evaluation case studies with a single treated unit and a donor pool. Using pysyncon, the workflow constructs a synthetic counterfactual and validates results through placebo and leave-one-out robustness tests.

Does propensity score matching work for estimating treatment effects under selection on observables?

Propensity score matching estimates treatment effects under selection on observables by creating comparable groups. The workflow requires generating balance and overlap diagnostics to ensure the causal inference assumptions hold within the dataset.