Announcement

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

  • Fixed Effects/Random Effects regressions - how to collapse sector controls in regression output?

    Hello !

    I am currently running FE/RE regressions on my dataset and I have a control variable "Sector". For the research itself, this variable is irrelevant: However, it has to be included as a control variable. Now I am wondering, how I can omit the Sector variable completely from the regression output in Stata while having it still in my regression equation.

    Thank you!

  • #2
    For fixed effects models, including dummies (e.g., sector dummies) in the estimation command has the same effect as absorbing the dummies. Therefore, you can be able to suppress the output of the dummy variables by absorbing them. However, this is not the case for random effects models. Here, if you need to include dummies, you have to explicitly specify them. Therefore, you will need to suppress all the output and display part of the results using a command designed to display regression output. Here, I use two community contributed commands to illustrate both points, i.e., reghdfe and esttab. Both are from SSC.

    *
    Code:
    Fixed effects: Absorbing indicators = explicitly including them
    webuse nlswork
    *ssc install reghdfe
    reghdfe ln_w grade age ttl_exp tenure not_smsa south i.occ, absorb(idcode year)
    reghdfe ln_w grade age ttl_exp tenure not_smsa south, absorb(idcode year occ)
    Res.:

    Code:
    . reghdfe ln_w grade age ttl_exp tenure not_smsa south i.occ, absorb(idcode year)
    (dropped 544 singleton observations)
    note: grade is probably collinear with the fixed effects (all partialled-out values are close to zero; tol = 1
    > .0e-09)
    (MWFE estimator converged in 8 iterations)
    note: grade omitted because of collinearity
    
    HDFE Linear regression                            Number of obs   =     27,427
    Absorbing 2 HDFE groups                           F(  17,  23255) =     168.38
                                                      Prob > F        =     0.0000
                                                      R-squared       =     0.6957
                                                      Adj R-squared   =     0.6411
                                                      Within R-sq.    =     0.1096
                                                      Root MSE        =     0.2851
    
    ------------------------------------------------------------------------------
         ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           grade |          0  (omitted)
             age |   .0072158    .009709     0.74   0.457    -.0118146    .0262461
         ttl_exp |   .0304072   .0014669    20.73   0.000      .027532    .0332824
          tenure |   .0096777    .000902    10.73   0.000     .0079098    .0114457
        not_smsa |  -.0937477   .0093765   -10.00   0.000    -.1121263   -.0753691
           south |  -.0597921   .0107538    -5.56   0.000    -.0808703   -.0387139
                 |
        occ_code |
              2  |  -.0202619   .0129402    -1.57   0.117    -.0456255    .0051016
              3  |  -.1133688   .0103046   -11.00   0.000    -.1335665   -.0931711
              4  |  -.1844529   .0137792   -13.39   0.000     -.211461   -.1574448
              5  |  -.0307221   .0199739    -1.54   0.124    -.0698722    .0084279
              6  |  -.0495888   .0126933    -3.91   0.000    -.0744685   -.0247092
              7  |  -.5869676   .0194275   -30.21   0.000    -.6250469   -.5488884
              8  |   -.230641    .011781   -19.58   0.000    -.2537325   -.2075494
              9  |   .3312037    .153792     2.15   0.031     .0297612    .6326462
             10  |  -.2971787   .0366011    -8.12   0.000    -.3689192   -.2254382
             11  |  -.0251918   .0264325    -0.95   0.341    -.0770013    .0266177
             12  |  -.1272336    .117997    -1.08   0.281    -.3585155    .1040484
             13  |  -.0225544   .0179197    -1.26   0.208    -.0576783    .0125695
                 |
           _cons |   1.409206   .2829857     4.98   0.000     .8545354    1.963877
    ------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    -----------------------------------------------------+
     Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -------------+---------------------------------------|
          idcode |      4141           0        4141     |
            year |        15           1          14     |
    -----------------------------------------------------+
    
    .
    . reghdfe ln_w grade age ttl_exp tenure not_smsa south, absorb(idcode year occ)
    (dropped 544 singleton observations)
    note: grade is probably collinear with the fixed effects (all partialled-out values are close to zero; tol = 1
    > .0e-09)
    (MWFE estimator converged in 15 iterations)
    note: grade omitted because of collinearity
    
    HDFE Linear regression                            Number of obs   =     27,427
    Absorbing 3 HDFE groups                           F(   5,  23255) =     243.90
                                                      Prob > F        =     0.0000
                                                      R-squared       =     0.6957
                                                      Adj R-squared   =     0.6411
                                                      Within R-sq.    =     0.0498
                                                      Root MSE        =     0.2851
    
    ------------------------------------------------------------------------------
         ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
           grade |          0  (omitted)
             age |   .0072158    .009709     0.74   0.457    -.0118146    .0262461
         ttl_exp |   .0304072   .0014669    20.73   0.000      .027532    .0332824
          tenure |   .0096777    .000902    10.73   0.000     .0079098    .0114457
        not_smsa |  -.0937477   .0093765   -10.00   0.000    -.1121263   -.0753691
           south |  -.0597921   .0107538    -5.56   0.000    -.0808703   -.0387139
           _cons |   1.298791   .2827473     4.59   0.000     .7445875    1.852994
    ------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    -----------------------------------------------------+
     Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -------------+---------------------------------------|
          idcode |      4141           0        4141     |
            year |        15           1          14     |
        occ_code |        13           1          12    ?|
    -----------------------------------------------------+
    ? = number of redundant parameters may be higher
    Here, you see the coefficient estimates stay the same whether I absorb the variable "occ" or I include its dummies in the regression. To suppress some output from a regression where the above property does not hold (e.g., a random effects model), I can ask Stata not to display the output using quietly and thereafter use the -drop()- or -keep()- option of esttab to display the results I want. However, you need to know how the coefficients are labeled, and you can use the -coeflegend()- option in the regression command to find this out.


    Code:
    quietly xtreg ln_w grade age ttl_exp tenure not_smsa south i.occ, re
    *ssc install esttab
    esttab, drop(*.occ_code)
    Res.:

    Code:
    . esttab, drop(*.occ_code)
    
    ----------------------------
                          (1)  
                      ln_wage  
    ----------------------------
    grade              0.0519***
                      (28.61)  
    
    age              -0.00366***
                      (-5.88)  
    
    ttl_exp            0.0272***
                      (25.42)  
    
    tenure             0.0128***
                      (15.65)  
    
    not_smsa           -0.129***
                     (-18.88)  
    
    south             -0.0912***
                     (-13.47)  
    
    _cons               1.151***
                      (38.40)  
    ----------------------------
    N                   27971  
    ----------------------------
    t statistics in parentheses
    * p<0.05, ** p<0.01, *** p<0.001

    Comment


    • #3
      It worked out! Thank you very much!

      Comment

      Working...
      X