Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Difference-in-differences with firm and time fixed effects; -reg- vs. -xtreg- command

    Hello Statalist,

    I want to conduct a difference-in-difference analysis with time and firm fixed effects using panel data. I want to run both -reg- and -xtreg- commands to calculate the DID estimator. I am not sure whether in my -reg- command I account for firm-fixed effects if I write it as follows:

    Code:
    reg y i.treat##i.post i.time (other covariates), vce(cluster firmID)
    For the sake of completeness, here is my -xtreg- command:

    Code:
    xtreg y i.treat##i.post i.time (other covariates), fe
    Could someone kindly provide me with some feedback on whether these commands are correct, and particularly whether #1 (the -reg- command) accounts for firm-fixed effects?

    Kind regards,
    Max

  • #2
    The first specification does not include firm FEs. You can accomplish that with -areg-, though the asymptotics are arguably a bit different.

    Comment


    • #3
      Thanks for your feedback Dimitriy!

      Follow-up question: could I include firm-fixed effects in my -reg- specification as follows:

      Code:
      reg y i.treat##i.post i.time i.firmID (other covariates), vce(cluster firmID)
      or is this generally not possible with a -reg- command? I've already tried to do it like this, however, there are too many firmIDs and Stata cannot compute it...

      Comment


      • #4
        I'd recommend using reghdfe instead

        Code:
         
         reghdfe y i.treat##i.post (other covariates), absorb(time firmID) vce(cluster firmID)

        Comment


        • #5
          Both -areg- and -reghdfe- would work.

          Comment

          Working...
          X