grad-did

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

雙重差分法 (Difference-in-Differences)

双重差分法 (Difference-in-Differences)

Overview

概述

Difference-in-Differences (DID) estimates causal effects by comparing the change in outcomes over time between a treatment group (affected by an intervention) and a control group (unaffected). By differencing out both time-invariant group differences and common time trends, DID isolates the treatment effect under the parallel trends assumption.
双重差分法(DID)通过比较受干预影响的处理组和未受影响的对照组随时间的结果变化来估计因果效应。通过剔除不随时间变化的组间差异和共同时间趋势,DID在平行趋势假设下分离出处理效应。

When to Use

适用场景

  • Evaluating the impact of a policy, regulation, or intervention
  • A natural experiment assigns treatment at a group level (state, industry, firm)
  • Panel or repeated cross-section data with pre- and post-treatment periods
  • Randomized experiment is infeasible but a plausible control group exists
  • 评估政策、法规或干预措施的影响
  • 自然实验以组(州、行业、企业)为单位分配处理
  • 包含处理前和处理后时期的面板数据或重复横截面数据
  • 随机实验不可行但存在合理的对照组

When NOT to Use

不适用场景

  • Parallel trends assumption is violated and cannot be remedied
  • Treatment and control groups differ in ways that change over time
  • Treatment is self-selected based on anticipated outcomes (anticipation effects)
  • Only post-treatment data are available (no pre-treatment baseline)
  • 平行趋势假设不成立且无法补救
  • 处理组和对照组在随时间变化的维度上存在差异
  • 处理是基于预期结果自主选择的(预期效应)
  • 仅能获取处理后数据(无处理前基线)

Assumptions

假设条件

IRON LAW: DID is valid ONLY if the parallel trends assumption holds —
without it, the estimated treatment effect is biased by differential
pre-existing trends.
Key assumptions:
  1. Parallel trends: absent treatment, treated and control groups would have followed the same trajectory
  2. No spillover effects from treated to control units (SUTVA)
  3. Treatment timing is sharp and exogenous
  4. Composition of groups is stable over time (no differential attrition)
铁律:只有当平行趋势假设成立时,DID才有效——
若该假设不成立,估计的处理效应会因组间预先存在的差异趋势而产生偏差。
核心假设:
  1. 平行趋势:若未实施处理,处理组和对照组的结果轨迹将保持一致
  2. 无溢出效应:处理组不会对对照组产生溢出影响(SUTVA)
  3. 处理时机明确且外生
  4. 组构成随时间稳定(无差异性流失)

Methodology

方法步骤

Step 1 — Establish Treatment and Control Groups

步骤1——确定处理组与对照组

Define who is treated and when. Verify groups are comparable on pre-treatment observables. Document the treatment event and its timing.
定义谁是处理对象以及处理时间。验证组间在处理前的可观测变量上具有可比性。记录处理事件及其发生时间。

Step 2 — Test Parallel Trends

步骤2——检验平行趋势

Plot outcome trends for treatment vs control groups in pre-treatment periods. Run an event-study specification with leads and lags. Pre-treatment coefficients should be statistically insignificant.
绘制处理组与对照组在处理前时期的结果趋势图。使用包含超前项和滞后项的事件研究模型进行回归。处理前的系数应在统计上不显著。

Step 3 — Estimate the DID Model

步骤3——估计DID模型

Y = β₀ + β₁×Treat + β₂×Post + β₃×(Treat×Post) + Controls + ε. The coefficient β₃ is the DID estimator. Cluster standard errors at the treatment assignment level. See
references/
for staggered adoption extensions.
Y = β₀ + β₁×Treat + β₂×Post + β₃×(Treat×Post) + Controls + ε。系数β₃即为DID估计量。在处理分配层面聚类标准误。如需了解多期处理的扩展方法,请查看
references/
目录。

Step 4 — Robustness Checks

步骤4——稳健性检验

Run placebo tests (fake treatment dates, fake treatment groups). Test sensitivity to control group choice. For staggered DID, use Callaway-Sant'Anna or Sun-Abraham estimators.
进行安慰剂检验(虚构处理日期、虚构处理组)。检验对照组选择的敏感性。对于多期DID,使用Callaway-Sant'Anna或Sun-Abraham估计量。

Output Format

输出格式

markdown
undefined
markdown
undefined

DID Analysis: [Policy / Intervention]

DID分析:[政策/干预措施]

Research Design

研究设计

ElementDescription
Treatment group[who]
Control group[who]
Treatment date[when]
Pre-treatment periods[range]
要素描述
处理组[对象]
对照组[对象]
处理日期[时间]
处理前时期[范围]

Parallel Trends Test

平行趋势检验

Pre-period leadCoefficientS.E.p-value
t-3x.xxx.xxx.xx
t-2x.xxx.xxx.xx
t-1x.xxx.xxx.xx
处理前超前项系数标准误p值
t-3x.xxx.xxx.xx
t-2x.xxx.xxx.xx
t-1x.xxx.xxx.xx

DID Estimate

DID估计结果

Specificationβ (Treat×Post)S.E.p-valueN
Baselinex.xxx.xxx.xxxxx
With controlsx.xxx.xxx.xxxxx
模型设定β (Treat×Post)标准误p值样本量N
基准模型x.xxx.xxx.xxxxx
加入控制变量x.xxx.xxx.xxxxx

Robustness

稳健性

  • Placebo test result: [pass/fail]
  • Alternative control group: [result]
  • 安慰剂检验结果:[通过/未通过]
  • 替代对照组:[结果]

Limitations

局限性

  • [Note any assumption violations]
undefined
  • [标注任何假设违反情况]
undefined

Gotchas

注意事项

  • Visual parallel trends are necessary but not sufficient — the assumption is about counterfactual trends
  • Too few clusters for clustering standard errors inflates Type I error (use wild bootstrap if clusters < 50)
  • Staggered adoption makes the standard two-way FE DID estimator biased (use recent robust estimators)
  • Anticipation effects violate the sharp treatment timing assumption
  • Differential pre-trends are often "fixed" by adding group-specific trends, but this is fragile
  • DID estimates a local average treatment effect on the treated (ATT), not ATE
  • 视觉上的平行趋势是必要条件但非充分条件——假设关注的是反事实趋势
  • 聚类数量过少会导致聚类标准误放大第一类错误(若聚类数<50,使用wild bootstrap)
  • 多期处理会使标准双向固定效应DID估计量产生偏差(使用最新的稳健估计量)
  • 预期效应会违反处理时机明确的假设
  • 组间差异趋势通常通过添加组特定趋势来“修正”,但这种方法不够稳健
  • DID估计的是处理组的局部平均处理效应(ATT),而非平均处理效应(ATE)

References

参考文献

  • Angrist, J. D., & Pischke, J.-S. (2009). Mostly Harmless Econometrics. Princeton University Press.
  • Callaway, B., & Sant'Anna, P. H. C. (2021). Difference-in-differences with multiple time periods. Journal of Econometrics, 225(2), 200-230.
  • Goodman-Bacon, A. (2021). Difference-in-differences with variation in treatment timing. Journal of Econometrics, 225(2), 254-277.
  • Angrist, J. D., & Pischke, J.-S. (2009). Mostly Harmless Econometrics. Princeton University Press.
  • Callaway, B., & Sant'Anna, P. H. C. (2021). Difference-in-differences with multiple time periods. Journal of Econometrics, 225(2), 200-230.
  • Goodman-Bacon, A. (2021). Difference-in-differences with variation in treatment timing. Journal of Econometrics, 225(2), 254-277.