You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's how to estimate treatment effects using extended TWFE (Wooldridge, 2021):
* gen time-varying treatment indicator
gen w = D // time-varying treatment indicator
tab w t // should be 35 units treated at t=7 and 35 treated at t=11
* gen ever-treated cohort indicators
egen d = max(w), by(i)
sort i t
gen dinf = (d==0) // d-infinity = never-treated cohort
gen d7 = (Ei==7)
gen d11 = (Ei==11)
* gen t dummies
foreach t in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 {
gen t`t' = (t==`t')
}
* estimate TE using Wooldridge ETWFE
* TEs vary by entry cohort and time period:
reg Y c.d7#c.t7 c.d7#c.t8 c.d7#c.t9 c.d7#c.t10 c.d7#c.t11 c.d7#c.t12 c.d7#c.t13 c.d7#c.t14 c.d7#c.t15 ///
c.d11#c.t11 c.d11#c.t12 c.d11#c.t13 c.d11#c.t14 c.d11#c.t15 ///
d7 d11 i.t, cluster(i)
* ATTs by cohort
lincom (c.d7#c.t7+c.d7#c.t8+c.d7#c.t9+c.d7#c.t10+c.d7#c.t11+c.d7#c.t12+c.d7#c.t13+c.d7#c.t14+c.d7#c.t15)/9 // ATT(g=7)
lincom (c.d11#c.t11+c.d11#c.t12+c.d11#c.t13+c.d11#c.t14+c.d11#c.t15)/5 // ATT(g=11)
* ATTs by event-time
lincom (c.d7#c.t7+c.d11#c.t11)/2 // 1 period since event
lincom (c.d7#c.t8+c.d11#c.t12)/2 // 2 periods since event
lincom (c.d7#c.t9+c.d11#c.t13)/2 // 3 periods since event
lincom (c.d7#c.t10+c.d11#c.t14)/2 // 4 periods since event
lincom (c.d7#c.t11+c.d11#c.t15)/2 // 5 periods since event
lincom (c.d7#c.t12) // 6 periods since event
lincom (c.d7#c.t13) // 7 periods since event
lincom (c.d7#c.t14) // 8 periods since event
lincom (c.d7#c.t15) // 9 periods since event
* compare to CS
csdid Y, ivar(i) time(t) gvar(gvar) notyet
estat group
estat event
The text was updated successfully, but these errors were encountered:
Here's how to estimate treatment effects using extended TWFE (Wooldridge, 2021):
The text was updated successfully, but these errors were encountered: