grantmcdermott / etwfe

Extended two-way fixed effects
https://grantmcdermott.com/etwfe/
Other
50 stars 11 forks source link

fe (shortcut?) argument #3

Closed grantmcdermott closed 1 year ago

grantmcdermott commented 1 year ago

Allow users to easily specify which of the following three equivalent models they want:

# varying slopes (current default)
feols(
  lemp ~ .Dtreat : i(first_treat, i.year, ref = 0, ref2 = 2003) / lpop_dm |
    first_treat[lpop] + year[lpop],
  data = mpdta, vcov = ~countyreal
  )

# fes only
feols(
  lemp ~ .Dtreat : i(first_treat, i.year, ref = 0, ref2 = 2003) / lpop_dm  +
    lpop +                           # changed
    i(first_treat, lpop, ref = 0) +  # changed
    i(year, lpop, ref = 2003) |      # changed
    first_treat + year,              # changed
  data = mpdta, vcov = ~countyreal
  )

# no fes at all
feols(
  lemp ~ .Dtreat : i(first_treat, i.year, ref = 0, ref2 = 2003) / lpop_dm  +
    lpop +                                          # changed
    i(first_treat, lpop, ref = 0) +                 # changed
    i(year, lpop, ref = 2003) +                     # changed
    i(first_treat, ref = 0) + i(year, ref = 2003),  # changed
  data = mpdta, vcov = ~countyreal
  )

Complication: Need to double check multiple controls...