New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sunab
not matching Stata Sun and Abraham implementation
#287
Comments
sunab
not matching sunab
not matching Stata Sun and Abraham implementation
Hi Kyle, Nope, the code isn't off: it simply appears that you forgot the fixed-effects in the example: res_sunab = feols(y ~ sunab(year_treated, year) | id + year, base_stagg)
res_sunab
#> OLS estimation, Dep. Var.: y
#> Observations: 950
#> Fixed-effects: id: 95, year: 10
#> Standard-errors: Clustered (id)
#> Estimate Std. Error t value Pr(>|t|)
#> year::-9 2.343297 1.122482 2.087603 0.039539 *
#> year::-8 -0.866391 1.186767 -0.730043 0.467179
#> year::-7 -0.345837 0.713641 -0.484608 0.629082
#> year::-6 -0.471113 0.731894 -0.643691 0.521343
#> year::-5 -0.796544 0.527162 -1.511005 0.134142
#> year::-4 -0.280033 0.429222 -0.652419 0.515723
#> year::-3 -0.315766 0.528401 -0.597587 0.551552
#> year::-2 0.241325 0.457825 0.527113 0.599357
#> ... 9 coefficients remaining (display them with summary() or use argument n)
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> RMSE: 1.98883 Adj. R2: 0.479262
#> Within R2: 0.424684
etable(res_sunab)
#> res_sunab
#> Dependent Var.: y
#>
#> year = -9 2.343* (1.122)
#> year = -8 -0.8664 (1.187)
#> year = -7 -0.3458 (0.7136)
#> year = -6 -0.4711 (0.7319)
#> year = -5 -0.7965 (0.5272)
#> year = -4 -0.2800 (0.4292)
#> year = -3 -0.3158 (0.5284)
#> year = -2 0.2413 (0.4578)
#> year = 0 -5.042*** (0.4155)
#> year = 1 -3.221*** (0.4579)
#> year = 2 -2.123*** (0.4976)
#> year = 3 0.0518 (0.4784)
#> year = 4 1.429* (0.6622)
#> year = 5 2.400** (0.8176)
#> year = 6 5.945*** (1.002)
#> year = 7 4.586** (1.610)
#> year = 8 7.953*** (0.9807)
#> Fixed-Effects: ------------------
#> id Yes
#> year Yes
#> _______________ __________________
#> S.E.: Clustered by: id
#> Observations 950
#> R2 0.58023
#> Within R2 0.42468
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 It does not mean that there isn't possibly other problems, but at least in this example it works. |
Oh! I'm embarrassed. I think I was looking at https://lrberge.github.io/fixest/reference/sunab.html and didn't realize that unit and time FEs were needed. I see them in the intro vignette. If you think it's a good idea, I can submit a pull request adding fixed effects to the |
Ooooch, that a major documentation bug then! I didn't notice it since I was only looking at the vignette. I've fixed it thanks! |
Hi Laurent,
I've gotten a few reports from folks that the Sun and Abraham code produces wonky results that don't look like other estimators e.g.: kylebutts/did2s#11. I have a feeling there is something off with your code because Sun and Abraham with a never-treated group, the correct reference periods being dropped, and no covariates is numerically equivalent to Callaway and Sant'Anna. In the above example, all three things are true and they don't match.
Prof. Sun has Stata code now for her estimator: https://github.com/lsun20/EventStudyInteract. As you can see,
did
matches with the stata Sun and Abraham implementation.Reprex:
R:
Created on 2022-03-29 by the reprex package (v2.0.1)
Stata:
The text was updated successfully, but these errors were encountered: