lrberge / fixest

Fixed-effects estimations
https://lrberge.github.io/fixest/
361 stars 59 forks source link

multiple regressions with l() function #436

Closed AlbuquerqueDaniel closed 4 months ago

AlbuquerqueDaniel commented 10 months ago

Hi,

I'm using the package to run multiple estimations for the variable in the LHS using the l() function, which is amazing. However, if I try to combine it with the sw()/csw() functions I believe it ignores them and just reports the most basic specification. For example: feols(l(y, (0:-12)) - l(y,1) ~ x, dt) works great and gives me the results for the 13 different regressions for the different changes in the LHS. However, if I try feols(l(y, (0:-12)) - l(y,1) ~ x + sw0(z), dt) it doesn't run 26 regressions, and I only have the results for the same as the initial set of regressions. Was this supposed to work? I saw in the "Multiple estimations" vignette that whenever doing multiple estimations on the LHS the example always use something like c("y1", "y2") and never l() so I'm not sure.

Thanks in any case for the amazing package.

lrberge commented 4 months ago

Hi, and thanks for the words :-)

For me it works fine:

data(base_did)
est = feols(l(y, 0:1) - l(y, 2) ~ x1 + sw0(x1^2), base_did, panel.id = ~ id + period)
models(est)
#>   id               lhs          rhs
#> 1  1       y - l(y, 2)           x1
#> 2  2       y - l(y, 2) x1 + I(x1^2)
#> 3  3 l(y, 1) - l(y, 2)           x1
#> 4  4 l(y, 1) - l(y, 2) x1 + I(x1^2)

It may be a package version issue. I'm closing then. Please reopen with a reproducible example if the problem persists.