did-analysis

Estimates Difference-in-Differences effects from panel data with treatment and control groups.

Updated Apr 15, 2026
One-click install
npx skills add https://github.com/sheehe/coase --skill did-analysis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: did-analysis
Source: https://github.com/sheehe/coase/tree/main/%E5%AE%9E%E8%AF%81%E7%A7%91%E7%A0%94%E6%8F%92%E4%BB%B6/econometrics/econometrics/skills/did-analysis
Command: npx skills add https://github.com/sheehe/coase --skill did-analysis

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Analyzes causal effects in panel data using Difference-in-Differences (DID) design, providing a structured workflow and interpretation to distinguish treatment effects from time trends.

Core Features & Use Cases

  • DID design validation: verify parallel trends, treatment timing, and eligibility.
  • Modeling options: 2×2 DID, TWFE with entity/time fixed effects, and robust alternatives for staggered adoption.
  • Event-study diagnostics: estimate dynamic effects and visualize pre/post trends.
  • Robustness & reporting: placebo tests, alternative controls, and interpretability guidelines for policy evaluation.
  • Guidance for heterogeneity: subgroup analyses and robust standard errors.

Quick Start

Provide a ready-to-use DID analysis workflow for your panel dataset with treatment and control groups.

Frequently Asked Questions about did-analysis

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

FAQPage Schema
How do I estimate treatment effects using difference-in-differences with panel data?

To estimate difference-in-differences effects, use a structured workflow requiring panel data with pre-treatment observations, clear treatment timing, and distinct treatment and control groups. This guides model selection from 2x2 DID to TWFE and robust alternatives to isolate causal effects.

What is the best way to handle staggered adoption in a difference-in-differences design?

Handle staggered adoption in difference-in-differences designs by using robust alternatives to standard TWFE, such as Callaway and Sant'Anna (CS/SA) or Sun-Abraham estimators. These methods prevent biased treatment effect estimates when units adopt policies at different times.

How do I validate parallel trends before running a difference-in-differences model?

Validate parallel trends in difference-in-differences by running event-study diagnostics to visualize pre-treatment trends. This checks if treatment and control groups followed similar trajectories before the intervention, ensuring the core identifying assumption holds.

Why does my TWFE model show negative weights in a staggered adoption difference-in-differences setup?

TWFE models in staggered adoption difference-in-differences setups can yield negative weights due to heterogeneous treatment effects across different timing cohorts. Using robust estimators like CS/SA or Sun-Abraham corrects this dynamic effect bias and provides accurate causal estimates.

What robustness checks should I run for a difference-in-differences policy evaluation?

Run robustness checks for difference-in-differences policy evaluations including placebo tests, alternative control groups, and sensitivity analyses. These steps validate your treatment timing and ensure that observed effects are not driven by unobserved time trends.

Can I analyze heterogeneous treatment effects across subgroups in a difference-in-differences framework?

Yes, you can analyze heterogeneous treatment effects across subgroups in a difference-in-differences framework by performing subgroup analyses with robust standard errors. This allows you to identify varying causal impacts across different populations within your panel data.