Announcement

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

  • How to use REGHDFE with absorb SAVEFE option? There is no difference between reghdfe with absorb and reghdfe with absorb savefe

    Hi everyone,

    Hi dear, my estimation model looks like following:

    Yijkt = β0 + β1 ∗ treat_j + β2 ∗ post_t + β3 ∗ treat_j ∗ post_t + β4X_it + ξ_i + δ_t + ψ_k + ϵ_ijkt
    where treat equals 1 if in the treatment group, post equals 1 if the year is equal to or greater than 2012 (policy takes effect in 2012), and X_it are city level time varying variables. ξ_i is the city fixed effect, δ_t is the time fixed effect, and ψ_k is the product fixed effect.

    I am running a regression reghdfe sales_spec did_1 treat_1 $X1list, absorb(i.code i.year i.product) vce(cl province) and reghdfe sales_spec did_1 treat_1 $X1list, absorb(i.code i.year i.product,savefe) vce(cl province) separately, however, there is no difference between the two results.

    Click image for larger version

Name:	WeChat 圖片_20220321173313.png
Views:	1
Size:	34.5 KB
ID:	1655398

    Click image for larger version

Name:	WeChat 圖片_20220321173321.png
Views:	1
Size:	32.9 KB
ID:	1655399


    The description demonstrated that using reghdfe with savefe saved the estimation results of fixed effects. I'm curious why the fixed effect coefficients were not saved here. Or if there is any misunderdanding about the savefe?

  • #2
    Wei:
    the requested fixed effects are saved as auxiliary variables:
    Code:
    use "https://www.stata-press.com/data/r17/nlswork.dta"
    . reghdfe ln_wage c.age##c.age, abs(idcode year, savefe) vce(cluster idcode)
    (dropped 551 singleton observations)
    (MWFE estimator converged in 8 iterations)
    
    HDFE Linear regression                            Number of obs   =     27,959
    Absorbing 2 HDFE groups                           F(   2,   4158) =      44.91
    Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                      R-squared       =     0.6593
                                                      Adj R-squared   =     0.5995
                                                      Within R-sq.    =     0.0115
    Number of clusters (idcode)  =      4,159         Root MSE        =     0.3013
    
                                 (Std. err. adjusted for 4,159 clusters in idcode)
    ------------------------------------------------------------------------------
                 |               Robust
         ln_wage | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -------------+----------------------------------------------------------------
             age |   .0728746   .0136873     5.32   0.000     .0460402    .0997089
                 |
     c.age#c.age |  -.0010113   .0001076    -9.39   0.000    -.0012224   -.0008003
                 |
           _cons |   .4586164   .3651743     1.26   0.209    -.2573205    1.174553
    ------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    -----------------------------------------------------+
     Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -------------+---------------------------------------|
          idcode |      4159        4159           0    *|
            year |        15           0          15     |
    -----------------------------------------------------+
    * = FE nested within cluster; treated as redundant for DoF computation
    
    
    . sum __hdfe1__ __hdfe2__
    
        Variable |        Obs        Mean    Std. dev.       Min        Max
    -------------+---------------------------------------------------------
       __hdfe1__ |     27,959   -2.13e-16    .3590021  -1.416543   2.059387
       __hdfe2__ |     27,959   -4.17e-17    .0477131  -.0629913   .1275064
    
    .
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Originally posted by Carlo Lazzaro View Post
      Wei:
      the requested fixed effects are saved as auxiliary variables:
      Code:
      use "https://www.stata-press.com/data/r17/nlswork.dta"
      . reghdfe ln_wage c.age##c.age, abs(idcode year, savefe) vce(cluster idcode)
      (dropped 551 singleton observations)
      (MWFE estimator converged in 8 iterations)
      
      HDFE Linear regression Number of obs = 27,959
      Absorbing 2 HDFE groups F( 2, 4158) = 44.91
      Statistics robust to heteroskedasticity Prob > F = 0.0000
      R-squared = 0.6593
      Adj R-squared = 0.5995
      Within R-sq. = 0.0115
      Number of clusters (idcode) = 4,159 Root MSE = 0.3013
      
      (Std. err. adjusted for 4,159 clusters in idcode)
      ------------------------------------------------------------------------------
      | Robust
      ln_wage | Coefficient std. err. t P>|t| [95% conf. interval]
      -------------+----------------------------------------------------------------
      age | .0728746 .0136873 5.32 0.000 .0460402 .0997089
      |
      c.age#c.age | -.0010113 .0001076 -9.39 0.000 -.0012224 -.0008003
      |
      _cons | .4586164 .3651743 1.26 0.209 -.2573205 1.174553
      ------------------------------------------------------------------------------
      
      Absorbed degrees of freedom:
      -----------------------------------------------------+
      Absorbed FE | Categories - Redundant = Num. Coefs |
      -------------+---------------------------------------|
      idcode | 4159 4159 0 *|
      year | 15 0 15 |
      -----------------------------------------------------+
      * = FE nested within cluster; treated as redundant for DoF computation
      
      
      . sum __hdfe1__ __hdfe2__
      
      Variable | Obs Mean Std. dev. Min Max
      -------------+---------------------------------------------------------
      __hdfe1__ | 27,959 -2.13e-16 .3590021 -1.416543 2.059387
      __hdfe2__ | 27,959 -4.17e-17 .0477131 -.0629913 .1275064
      
      .
      Dear Carlo,

      Thank you for your assistance; it iworks. That means I'll get the coefficients of those fixed effects and, hopefully, the coeffecient of treatment and post.


      Best regards,
      Wei

      Comment

      Working...
      X