Announcement

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

  • #16
    Both the coefs and the standard errors are incorrect. For instance, consider this example:

    Code:
    * Create dataset
    sysuse auto, clear
    global vars price weight length
    rename turn id
    sort id, stable
    by id: gen time = _n
    xtset id time
    
    * Wrong
    foreach var of varlist $vars {
    by id: egen `var'_m = mean(`var')
    gen `var'_dm = `var' - `var'_m
    }
    areg *_dm, absorb(time)
    
    * Correct
    areg price weight length i.time, a(id)
    
    * Correct
    reghdfe price weight length, a(id time) keepsingleton
    On the other hand, approximations like the one you mentioned have been used and published in the past because they were thought as "good enough". However, they are not really "good enough" as e.g. Gormley & Matsa (2014) discuss.
    Last edited by Sergio Correia; 13 May 2015, 17:55.

    Comment


    • #17
      Also, in case you are curious, this is also correct (it's based on your code, but with a loop outside)

      Code:
      rename ($vars) =_dm
      forv i=1/10 {
          foreach var of varlist $vars {
              qui areg `var', absorb(id)
              predict double resid, resid
              drop `var'
              rename resid `var'
              qui areg `var', absorb(time)
              predict double resid, resid
              drop `var'
              rename resid `var'
          }
      }
      regress *_dm, nocons
      (It's basically what -reghdfe- does, minus the 5000 lines of parsing and mata code)

      Comment


      • #18
        Thanks for the example. I only briefly checked it for a balanced panel data set. Apparently, my statement about the coefficients was wrong for unbalanced data.
        https://www.kripfganz.de/stata/

        Comment


        • #19
          Hey guys,

          thanks for the many answers. I will do it with xtreg and -i.time- and just delete all the time coefficients latex after exporting them.

          Best Dave

          Comment


          • #20
            Originally posted by Jeff Wooldridge View Post
            I'm not an expert on estout, but isn't it possible to quietly do the command and then use the "keep" option to keep only the coefficients on x1 ... xn? Unfortunately, I don't have total command of the syntax of estout so I can't provide the exact command. JW
            As Jeff suggested, you can keep only coefficients that you want before exporting them with the user-written estout/esttab, with the keep() option or the drop() option.

            Comment

            Working...
            X