-
Notifications
You must be signed in to change notification settings - Fork 74
Question about fixed effects with relative periods entered in sunab() #642
Description
Hi! First, thank you so much for this package. It's been very useful!
One thing I like about this package is that I can enter relative periods to the Sun & Abraham estimator. This seems to be the only R package that both accommodates non-linear, staggered DiD and gives enough flexibility to manually enter relative periods to, for instance, separate out observations occurring in the same year but where some are technically pre-event and some are post-event. If However, if I'm misunderstanding that use of relative periods, I'd appreciate you letting me know.
Regardless of that particular use case, I am unclear on how to specify the fixed effects that must be included in the feglm(), feols(), etc. syntax when relative periods (rather than time periods themselves) are included in the sunab() function. From trying out two options with the base_stagg example, it seems like it's expected that we include the periods (e.g., years) themselves as the fixed effect? Could this be explained more fully in the documentation? (similar to issue #287 )
> data(base_stagg)
> res_sunab = feols(y ~ x1 + sunab(year_treated, year) | id + year, base_stagg)
> res_sunab_rps = feols(y ~ x1 + sunab(year_treated, time_to_treatment) | id + year, base_stagg)
> res_sunab_rps2 = feols(y ~ x1 + sunab(year_treated, time_to_treatment) | id + time_to_treatment, base_stagg)
The variables 'time_to_treatment::-9:cohort::10', 'time_to_treatment::-8:cohort::10',
'time_to_treatment::-7:cohort::10', 'time_to_treatment::-6:cohort::10',
'time_to_treatment::-5:cohort::10', 'time_to_treatment::-4:cohort::10' and 11 others have been
removed because of collinearity (see $collin.var).
> esttable(res_sunab , res_sunab_rps , res_sunab_rps2)
res_sunab res_sunab_rps res_sunab_rps2
Dependent Var.: y y y
x1 0.9947*** (0.0188) 0.9947*** (0.0188) 0.9899*** (0.0177)
year = -9 0.3518 (0.6829)
year = -8 -0.0790 (0.4824)
year = -7 0.1010 (0.3938)
year = -6 -0.0564 (0.3410)
year = -5 -0.2953 (0.3023)
year = -4 -0.3037 (0.2720)
year = -3 -0.0884 (0.2492)
year = -2 0.0847 (0.2313)
year = 0 -5.188*** (0.2179)
year = 1 -3.540*** (0.2328)
year = 2 -2.155*** (0.2509)
year = 3 -0.7750** (0.2746)
year = 4 1.069*** (0.3050)
year = 5 2.118*** (0.3410)
year = 6 4.631*** (0.3944)
year = 7 4.890*** (0.4822)
year = 8 6.244*** (0.6826)
time_to_treatment = -9 0.3518 (0.6829)
time_to_treatment = -8 -0.0790 (0.4824) 0.4884 (0.9240)
time_to_treatment = -7 0.1010 (0.3938) -0.2408 (0.8008)
time_to_treatment = -6 -0.0564 (0.3410) 0.5766 (0.7545)
time_to_treatment = -5 -0.2953 (0.3023) 0.0462 (0.7303)
time_to_treatment = -4 -0.3037 (0.2720) -0.9506 (0.7155)
time_to_treatment = -3 -0.0884 (0.2492) -0.5674 (0.7061)
time_to_treatment = -2 0.0847 (0.2313) 0.1807 (0.6984)
time_to_treatment = 0 -5.188*** (0.2179) 3.805*** (0.6928)
time_to_treatment = 1 -3.540*** (0.2328) 3.569*** (0.6983)
time_to_treatment = 2 -2.155*** (0.2509) 1.960** (0.7055)
time_to_treatment = 3 -0.7750** (0.2746) 4.524*** (0.7157)
time_to_treatment = 4 1.069*** (0.3050) 2.645*** (0.7310)
time_to_treatment = 5 2.118*** (0.3410) 3.691*** (0.7544)
time_to_treatment = 6 4.631*** (0.3944) 1.199 (0.7999)
time_to_treatment = 7 4.890*** (0.4822) 0.5815 (0.9237)
time_to_treatment = 8 6.244*** (0.6826)
Fixed-Effects: ------------------ ------------------ ------------------
id Yes Yes Yes
year Yes Yes No
time_to_treatment No No Yes
______________________ __________________ __________________ __________________
S.E. type IID IID IID
Observations 950 950 950
R2 0.90982 0.90982 0.90803
Within R2 0.87641 0.87641 0.82739
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1`