Announcement

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

  • Absorb Dummy variables

    Hello,


    I'm running a fixed effects model with time fixed effects.
    I would like to have the results without the values for all time dummies.
    Can someone help me with the code for this?
    Thank you in advance!

  • #2
    I would like to have the results without the values for all time dummies.
    Can you be more specific: what does this mean?

    Comment


    • #3
      There are many ways to see the results without the values for the time dummies, but the one I personally prefer is to use Segio Correia's reghdfe command (available on ssc).

      E.g.
      Code:
      use http://www.stata-press.com/data/r14/abdata.dta, clear
      Code:
      . xtreg n w k i.year, fe
      
      Fixed-effects (within) regression               Number of obs     =      1,031
      Group variable: id                              Number of groups  =        140
      
      R-sq:                                           Obs per group:
           within  = 0.6277                                         min =          7
           between = 0.8473                                         avg =        7.4
           overall = 0.8346                                         max =          9
      
                                                      F(10,881)         =     148.56
      corr(u_i, Xb)  = 0.5666                         Prob > F          =     0.0000
      
      ------------------------------------------------------------------------------
                 n |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
                 w |  -.2731482   .0551503    -4.95   0.000    -.3813896   -.1649068
                 k |   .5648036   .0212211    26.62   0.000     .5231537    .6064535
                   |
              year |
             1977  |  -.0347963   .0188134    -1.85   0.065    -.0717206    .0021281
             1978  |  -.0583286   .0190916    -3.06   0.002    -.0957989   -.0208583
             1979  |   -.070047   .0190414    -3.68   0.000    -.1074187   -.0326752
             1980  |  -.0889378   .0189788    -4.69   0.000    -.1261867   -.0516889
             1981  |  -.1401502   .0186309    -7.52   0.000    -.1767163   -.1035841
             1982  |  -.1603768   .0188132    -8.52   0.000    -.1973008   -.1234528
             1983  |  -.1621103   .0222902    -7.27   0.000    -.2058585   -.1183621
             1984  |  -.1258136   .0282391    -4.46   0.000    -.1812373   -.0703899
                   |
             _cons |   2.255419   .1772614    12.72   0.000     1.907515    2.603323
      -------------+----------------------------------------------------------------
           sigma_u |  .64723143
           sigma_e |  .12836859
               rho |  .96215208   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      F test that all u_i=0: F(139, 881) = 126.32                  Prob > F = 0.0000
      becomes

      Code:
      . reghdfe n w k, absorb(id year)
      (converged in 7 iterations)
      
      HDFE Linear regression                            Number of obs   =      1,031
      Absorbing 2 HDFE groups                           F(   2,    881) =     362.67
                                                        Prob > F        =     0.0000
                                                        R-squared       =     0.9922
                                                        Adj R-squared   =     0.9908
                                                        Within R-sq.    =     0.4516
                                                        Root MSE        =     0.1284
      
      ------------------------------------------------------------------------------
                 n |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
                 w |  -.2731482   .0551503    -4.95   0.000    -.3813896   -.1649068
                 k |   .5648036   .0212211    26.62   0.000     .5231537    .6064535
      -------------+----------------------------------------------------------------
          Absorbed |       F(147, 881) =    120.660   0.000             (Joint test)
      ------------------------------------------------------------------------------
      
      Absorbed degrees of freedom:
      ---------------------------------------------------------------+
       Absorbed FE |  Num. Coefs.  =   Categories  -   Redundant     |
      -------------+-------------------------------------------------|
                id |          140             140              0     |
              year |            8               9              1     |
      ---------------------------------------------------------------+

      Comment


      • #4
        Hello,

        Thank you for your suggestion. But it is still not working. The variable that I want to absorb is "year_q" and it is in the following regression:


        xtreg log_Y lag_X1 X2 X3 X4 X5 i.year_q if list_OECD==1, fe vce(cluster country)


        Can someone help me with this issue?

        Thank you in advance.

        Comment


        • #5
          Although I don't understand why this is a problem (I would just ignore the output), Jesse suggested a different command. It's not helpful for us if you report the error just as "it's not working". We, at least, need the error notification.

          Comment


          • #6
            Hello. Thank you for answer. I regress the following model (with country and time fixed effects):

            xtreg log_Y X1 X2 X3 X4 X5 i.year_q (absorb id year_q), fe vce(cluster country)

            It appear an error saying "variable absorb not found".

            When I regress the model: xtreg log_Y X1 X2 X3 X4 X5 i.year_q, fe vce(cluster country), appears all the values for the year dummies. I would like to know if I can have the result of this regression without appearing all this values for the year dummies? I would like to have a result like Jesse Wursten (#3) explains...but I have the "variable absorb not found" error.
            Can someone help me with this issue?

            Thank you in advance.

            Comment


            • #7
              Ana,

              you are using the wrong command. The syntax suggested by Jesse only works with the following command -reghdfe- (-not xtreg-):

              The following should work:

              Code:
              reghdfe log_Y X1 X2 X3 X4 X5, absorb(id year_q) vce(cluster country)
              Before calling this command you probably need to call ssc install reghdfe because it is not a standard Stata command but user-written.

              Another approach would be to quietly estimate your regression an then use estimates table with the drop option.

              Code:
              quietly: xtreg log_Y lag_X1 X2 X3 X4 X5 i.year_q if list_OECD==1, fe vce(cluster country)
              estimates table, drop(i.year)
              I personally prefer the user-written command esttab (available by typing ssc install estout) over estimates table.

              If you like to use esttab, the syntax becomes:

              Code:
              ssc install estout
              quietly: xtreg log_Y lag_X1 X2 X3 X4 X5 i.year_q if list_OECD==1, fe vce(cluster country)
              esttab, drop(*.year)
              Both commands estimates table and esttab allow you to modify and export the layout of the table. Admittedly, the learning curve for esttab (and its bigger brother estout) is quite steep due to the many options. I always export my results with esttab. Therefore, it is no problem for me if a regression command displays more results than I actually need.

              Comment


              • #8
                Hi everyone,

                Thank you for all the nice explanations. I have a very basic doubt regarding the use of 'absorb' option in panel regression in Stata. How using a categorical variable with absorb command is different from using it in form of a factor variable with i.dummy in a panel regression?

                Comment


                • #9
                  Originally posted by Sudatta Mohapatra View Post
                  Hi everyone,

                  Thank you for all the nice explanations. I have a very basic doubt regarding the use of 'absorb' option in panel regression in Stata. How using a categorical variable with absorb command is different from using it in form of a factor variable with i.dummy in a panel regression?
                  Query with a correction:

                  Hi everyone,

                  Thank you for all the nice explanations. I have a very basic doubt regarding the use of 'absorb' option in panel regression in Stata. How using a categorical variable with absorb option is different from using it in form of a factor variable with i.dummy when executing a panel fixed effect regression in Stata?

                  Comment


                  • #10
                    Code:
                    areg y x, absorb(z)
                    and

                    Code:
                    reg y x i.z
                    are the same, but if you have many levels of z Stata will calculate very long, and you might hit the Stata limits as to how many variables you can have and how big your matrices can be.

                    Originally posted by Sudatta Mohapatra View Post

                    Query with a correction:

                    Hi everyone,

                    Thank you for all the nice explanations. I have a very basic doubt regarding the use of 'absorb' option in panel regression in Stata. How using a categorical variable with absorb option is different from using it in form of a factor variable with i.dummy when executing a panel fixed effect regression in Stata?

                    Comment


                    • #11
                      Originally posted by Sudatta Mohapatra View Post
                      Hi everyone,

                      Thank you for all the nice explanations. I have a very basic doubt regarding the use of 'absorb' option in panel regression in Stata. How using a categorical variable with absorb command is different from using it in form of a factor variable with i.dummy in a panel regression?
                      Query with a correction:

                      Hi everyone,

                      Thank you for all the nice explanations. I have a very basic doubt regarding the use of 'absorb' option in panel regression in Stata. How using a categorical variable with absorb option is different from using it in form of a factor variable with i.dummy when executing a panel fixed effect regression in Stata?

                      Comment


                      • #12
                        Originally posted by Sudatta Mohapatra View Post

                        Query with a correction:

                        Hi everyone,

                        Thank you for all the nice explanations. I have a very basic doubt regarding the use of 'absorb' option in panel regression in Stata. How using a categorical variable with absorb option is different from using it in form of a factor variable with i.dummy when executing a panel fixed effect regression in Stata?
                        Please kindly discard the above post. I posted it twice accidentally!

                        Thanks!

                        Comment


                        • #13
                          Originally posted by Joro Kolev View Post
                          Code:
                          areg y x, absorb(z)
                          and

                          Code:
                          reg y x i.z
                          are the same, but if you have many levels of z Stata will calculate very long, and you might hit the Stata limits as to how many variables you can have and how big your matrices can be.


                          Thank you very much, Dr. Kolev for clearing my doubt about 'absorb' option. I really appreciate it a lot.

                          Comment

                          Working...
                          X