wenddymacro / Lee_Wooldridge_2023

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lee and Wooldridge 2023

"A Simple Transformation Approach to Difference-in-Differences Estimation for Panel Data"
Available on SSRN https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4516518

How to Apply Rolling Methods

1. Common Timing Case

Basic set up

  1. Time Periods: $t \in {1,...,T}$

    • Time dummies: $f02_t, ...,f0T_t$
    • i.e., $f04 =1$ if $t=4$
  2. First intervention occurs at $S$, $1 < S \leq T$

  3. There are two observable covariates $X=(X_1, X_2)$

Procedure 3.1

Step.1 For a given time period $t = S, \ldots, T$ and each unit $i$, compute

$$\dot{Y}_{it} \equiv Y_{it}-\frac{1}{S-1} \sum_{q=1}^{S-1} Y_{iq}$$

Step.2 Using all of units, apply standard TE methods - such as linear RA, IPW, IPWRA, PS matching - to the cross section

$$\{ ( \dot{Y}_{it}, D_i, \mathbf{X}_i) \ , \ i \ = \ 1, \ldots, N ; t= S, \ldots, T \}$$

Stata commands

Step.1 Genereting $\dot{Y}_{it}$

xtset id year
	bysort id: gen y_dot = y - (L1.y + L2.y + L3.y)/3 if f04
	bysort id: replace y_dot = y - (L2.y + L3.y + L4.y)/3 if f05
	bysort id: replace y_dot = y - (L3.y + L4.y + L5.y)/3 if f06

Step.2 Applying standard TE methods you want

In Step 2 of Procedure 3.1, you can use built-in commands in Stata.

For example, to get Rolling RA estimates for ATTs in each post-treatment period, $t = 4, 5, 6 $,

	teffects ra (y_dot x1 x2) (d) if f04, atet
	teffects ra (y_dot x1 x2) (d) if f05, atet
	teffects ra (y_dot x1 x2) (d) if f06, atet

For Rolling IPWRA estimates for ATTs in each post-treatment period, $t = 4, 5, 6 $

	teffects ipwra (y_dot x1 x2) (d x1 x2) if f04, atet
	teffects ipwra (y_dot x1 x2) (d x1 x2) if f05, atet
	teffects ipwra (y_dot x1 x2) (d x1 x2) if f06, atet

For more details, please refer to "1.lee_wooldridge_rolling_common.do" and "1.lee_wooldridge_common_data.dta"

2. Staggered Intervension Case

Basic set up

  1. Time Periods: $t \in {1,...,T}$

  2. First unit is treated at $S$, $1 < S \leq T$

  3. Cohort Indicator, for $g \in{S,...,T}$

    • $D_g=1$ if unit $i$ is first subjected to the intervention at time $g$
    • $D_\infty=1$ if unit is never treated in $ S,...,T$
  4. There are two observable covariates $X=(X_1, X_2)$

Procedure 4.1

Step.1 For $t \in { g, g+1, \ldots, T }$ and each unit $i$, compute

$$\dot{Y}_{igt} \equiv Y_{it}-\frac{1}{g-1} \sum_{q=1}^{g-1} Y_{iq}$$

Step.2 Choose as the control group the not-yet-treated units with

$$A_{t+1} \equiv D_{i, t+1} + D_{i,t+2} + \cdots + D_T + D_{\infty} = 1$$

Step.3 Using the subset of data units ($A_{t+1} +D_g = 1$), apply standard TE methods - such as linear RA, IPW, IPWRA, PS matching - to

$$\{ ( \dot{Y}_{igt}, D_{ig}, \mathbf{X}_i ) \quad , { i = 1, \ldots, N; g = S, \ldots, T; t = g, g+1, ..., T } \}$$

Stata commands

Step.1 Genereting $\dot{Y}_{igt}$

xtset id year
%y_i44 , y_i45, y_i46
	bysort id: gen y_44 = y - (L1.y + L2.y + L3.y)/3 if f04
	bysort id: gen y_45 = y - (L2.y + L3.y + L4.y)/3 if f05
	bysort id: gen y_46 = y - (L3.y + L4.y + L5.y)/3 if f06

%y_i55, y_i56
	bysort id: gen y_55 = y - (L1.y + L2.y + L3.y + L4.y)/4 if f05
	bysort id: gen y_56 = y - (L2.y + L3.y + L4.y +L5.y)/4 if f06

%y_i66
	bysort id: gen y_66 = y - (L1.y + L2.y + L3.y + L4.y+L5.y)/5 if f06

Step.2 & 3 Applying standard TE methods you want

In Step 3 of Procedure 4.1, you can use built-in commands in Stata after selecting "control group" carefully.

For example, to get Rolling RA estimates for ATTs in each post-treatment period of g4, $t = 4, 5, 6 $,

%% Control group consists of g_{\infty} (=Never-treated group) , g_5 and  g_6
	teffects ra (y_44 x1 x2) (g4) if f04, atet

%% Now, Control group was reduced to g_{\infty} and g6
	teffects ra (y_45 x1 x2) (g4) if f05 & ~g5, atet

%% Only g_{\infty} is in control group
	teffects ra (y_46 x1 x2) (g4) if f06 & (g5 + g6 != 1), atet

For Rolling IPWRA estimates for ATTs in each post-treatment period of g4 at $t = 5$

%% Control group consists of g_{\infty} & g6
	teffects ipwra (y_45 x1 x2) (g4 x1 x2) if f05 & ~g5, atet

For more details, please refer to "2.lee_wooldridge_rolling_staggered.do" and "2.lee_wooldridge_staggered_data.dta"

About


Languages

Language:Stata 100.0%