Announcement

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

  • Distribution of FE

    Hello everyone.

    I am trying to get the distribution of firm fixed effects (acquirer FE) when I also have in the regression year FE. Does anyone know how to get them isolated? So far I only know how to use the following code, but I think it includes both acquirer and year FE.

    year_and_cusipgroup is a concat of year and cusip_group, which is a group variable for cusip, my company id.

    Code:
    xtset year_and_cusipgroup
    xtreg car, fe i(year_and_cusipgroup)
    predict year_and_cusipgroup_1, u

  • #2
    Linda:
    have you taken a look at the community-contributed command -reghdfe-?
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Carlo,

      First of all, thank you for your response. I had a look at it now, but I still don't understand how to use both fixed effects in a reghdfe and get the distribution and statistics of only one FE.

      I tried this code but STATA gave back "invalid options: predict(cusip_group) r(9)".

      Do you have any extra recommendations?

      Code:
      reghdfe car, absorb(cusip_group year) predict(cusip_group)
      Thanks!

      Comment


      • #4
        I also tried this other code, by reading to the description of reghdfe.

        Code:
        reghdfe car, absorb(cusip_group year, savefe)
        I attach the results I obtained. I am not sure how to interpret it...I apologise as I am still a beginner with STATA.
        Attached Files

        Comment


        • #5
          Linda:
          I fail to get what you're after.
          That said, from the results you posted (for the future please do not share scrrenshots but use CODE delimiters instead. Thanks), being the within R-sq=0, I doubt that you have evidence of a group-wise fixed effect.
          If, for any reason, you want to save the fes, you can tweak the following code, that was retrieved from the help file of the community-contributed command -reghdfe-:
          Code:
          use "http://www.stata-press.com/data/r16/nlswork.dta"
          . reghdfe ln_w grade age ttl_exp tenure not_smsa south , absorb(FE1=idcode FE2=year)
          (dropped 550 singleton observations)
          (converged in 9 iterations)
          note: grade omitted because of collinearity
          (converged in 9 iterations)
          
          HDFE Linear regression                            Number of obs   =     27,541
          Absorbing 2 HDFE groups                           F(   5,  23375) =     261.99
                                                            Prob > F        =     0.0000
                                                            R-squared       =     0.6762
                                                            Adj R-squared   =     0.6185
                                                            Within R-sq.    =     0.0531
                                                            Root MSE        =     0.2939
          
          ------------------------------------------------------------------------------
               ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
                 grade |          0  (omitted)
                   age |   .0114497   .0099824     1.15   0.251    -.0081165    .0310159
               ttl_exp |   .0323758   .0015046    21.52   0.000     .0294266     .035325
                tenure |   .0104689   .0009264    11.30   0.000     .0086531    .0122847
              not_smsa |  -.0914148   .0096386    -9.48   0.000    -.1103071   -.0725225
                 south |  -.0640471   .0110539    -5.79   0.000    -.0857134   -.0423808
          -------------+----------------------------------------------------------------
              Absorbed |    F(4160, 23375) =      5.501   0.000             (Joint test)
          ------------------------------------------------------------------------------
          
          Absorbed degrees of freedom:
          ---------------------------------------------------------------+
           Absorbed FE |  Num. Coefs.  =   Categories  -   Redundant     |
          -------------+-------------------------------------------------|
                idcode |         4147            4147              0     |
                  year |           14              15              1     |
          ---------------------------------------------------------------+
          
          . sum FE1 FE2
          
              Variable |        Obs        Mean    Std. Dev.       Min        Max
          -------------+---------------------------------------------------------
                   FE1 |     27,541    5.66e-17    .3169373  -1.378648   1.946491
                   FE2 |     27,541   -5.86e-18    .1045295  -.1716042   .1583403
          
          .
          Kind regards,
          Carlo
          (Stata 19.0)

          Comment


          • #6
            Dear Carlo,

            I think I solved the issue. Thank you very much for your help!

            Kind regards,
            Linda Pasi

            Comment


            • #7
              Linda:
              happy with reading that you've solved the issue.
              This forum encourages sharing the solution the original posters found out themselves, as others stumbling upon the same problem could greatly benefit from them.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #8
                Dear Carlo,

                Of course.

                I used this code to obtain the distribution and summary statistics of the different FE:

                cusip_group is a group variable of my company id.

                Code:
                reghdfe y, absorb (cusip_group year, savefe)
                summarize _hdfe1_, detail

                Comment


                • #9
                  Linda:
                  thanks for sharing.
                  Kind regards,
                  Carlo
                  (Stata 19.0)

                  Comment


                  • #10
                    Dear Carlo,

                    I am also struggling with a loop. I created a new post here: https://www.statalist.org/forums/for...lready-defined.

                    If you have time to look quickly at it, maybe you could give me some advice?

                    Thanks in advance.

                    Kind regards,
                    Linda


                    Comment

                    Working...
                    X