Announcement

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

  • Firm vs Industry fixed effects

    Dear Statalists,

    I am struggling with choosing firm or industry fixed-effect for my regression with unbalanced panel data of around 800 firms of 48 industry sectors over 12 years.

    I got y is the dependent variable, and x is my main variable of interest, with 6 other control variables

    In the regression with firm fixed-effect, the coefficient of x is negative and significant at 1%

    Code:
    areg y x var1 var2 var3 var4 var5 var6 i.year, absorb(firm) ro
    But in the regression with industry fixed-effect, the coefficient of x is positive and significant at 1%

    Code:
    areg y x var1 var2 var3 var4 var5 var6 i.year, absorb(industry) ro
    So choosing firm vs industry fixed-effects flips the signs (also the values) of the coefficients. Prior research in the literature used industry fixed-effects, but the literature also suggests the coefficient of x should be negative, which is what I expect.


    Also, I have tried to put in and out the controls, and I found that one of the controls - var1, if I keep it in the models, the sign of x will changes along with the changes of the type of fixed-effects. But if I exclude var1, either firm or industry fixed-effects, the sign of x does not change. The correlation between x and var1 is 0.41***, and I check vif values below 4, so it could not be the multicollinearity here. Other correlations among other variables are low (below 0.1) as well.

    So I am not sure if the sign flipping results from the fixed-effect choices or from the var1.

    Can anyone suggest which fixed-effect I should choose (if it comes from the issue choosing the fixed-effects)?

    If the issue from the var1, is the var1 more sensitive to firm fixed-effect than industry-effect? If so, is there any way to mitigate its sensitivity, so that it won't affect to change the sign of my main variable?

    I really appreciate your help.

    Ken

    p/s: my question is more about choosing fixed-effects, so it seems that I should not upload a data sample here.

  • #2
    Well, both models, industry and firm level fixed effects, are fundamentally wrong. What you have is a three-level data structure: repeated observations over time nested within firms which are nested within industries. By using a fixed-effects estimator you have no choice but to mutilate the structure of the data in some way, omitting one of the levels. A three-level random effects model is more appropriate here.

    Comment


    • #3
      ¿Cómo soluciono mi problema? Me sale este error

      I have banks in Peru between 2000 and 2012 with monthly frequency.

      How do I solve my problem? I get this error
      repeated time values within panel
      r(451);
      Last edited by Alex Rengifo; 18 Apr 2019, 21:22.

      Comment


      • #4
        Dear Clyde Schechter ,

        Thank you for your reply.

        Can you please show me what correct code/command I should use? Because I follow prior research in which they say they include industry and year fixed-effects and standard errors are clustered at firm level.

        Code:
        xtset industry
        xtreg y x var1 var2 var3 var4 var5 var6 i.year, fe vce(cluster firm)
        panels are not nested within clusters
        r(498);
        I really appreciate your help.
        Last edited by Ken Yang; 19 Apr 2019, 03:02.

        Comment


        • #5
          Alex:
          if you do not have genuine duplicates (ie, mistaken data entries that you should eliminate from your database) and do not plan to use time-series related commands, such as lags and leads, you can -xtset- your data with the -panelid- only:
          Code:
          xtset banks
          Kind regards,
          Carlo
          (Stata 18.0 SE)

          Comment


          • #6
            Dear Carlo Lazzaro,

            Can you also show me how to xtset my data set, so that I can do industry and year fixed-effects for unbalanced panel data of around 800 firms of 48 industry sectors over 12 years, please?

            I really appreciate your help.

            Comment


            • #7
              Ken:
              have you already taken a look at the community-contributed command -reghdfe-?
              Kind regards,
              Carlo
              (Stata 18.0 SE)

              Comment


              • #8
                Ken:
                as a second thought, what about:
                Code:
                xtset firm year
                xtreg
                 y x var1 var2 var3 var4 var5 var6 i.year, fe vce(cluster firm)
                Obviously, due to the -fe- machinery, adding -i.industry- would make sense if and only if some firms change industry as time goes by (but ity's pretty rare to happen).
                In addition, clustering standard errors makes sense if you detect heteroskedasticity and/or autocorrelation in the idiosyncratic error distribution.
                Kind regards,
                Carlo
                (Stata 18.0 SE)

                Comment


                • #9
                  Dear Carlo Lazzaro,

                  Thank you for your suggestions, but xtset firm year and then use xtreg ,fe will be firm fixed effect if I am correct.

                  Also, I add i.industry into the xtreg ,fe, then all the industries are omitted because of collinearity.

                  re: -reghdfe- I am looking for any official instructions how to use -reghdfe- I just searched for it after your message.
                  I got this error when I tried -reghdfe-
                  Code:
                  reghdfe y x var1 var2 var3 var4 var5 var6, absorb(industry year) vce(cluster firm)
                  (MWFE estimator converged in 4 iterations)
                  class FixedEffects undefined
                  r(3000);
                  I may do something wrong. If you know, please correct the code, or please tell me where I can find the instructions of -reghdfe- ?


                  Many thanks for you help.

                  Comment


                  • #10
                    Ken:
                    as expected, the -fe- machinery wipes out any time-invariant predictor.
                    As per the messare returned by -reghdfe-, I would assess if you really have evidence of panel-wise effect in your dataset, first.
                    Hence, I would rely on the capabilities of another glorious community-contributed command: -xtoverid- (that works after -xtreg,re-). Being a bit old-fashioned, it does not support -fvvarlist- notation, but there's an easy workaround for this, as you can see from the following code:
                    Code:
                    xi: xtreg y x var1 var2 var3 var4 var5 var6 i.industry i.year, re vce(cluster firm)
                    xtoverid
                    If the -xtoverid outcome reaches statistica significance, go -fe- (losing time-invariant predictors); otherwise, stick with the -re- specification.
                    Eventually, if your data don't support the evidence of panel-wise effect, -xtoverid- outcome advises you to consider a pooled OLS.
                    Kind regards,
                    Carlo
                    (Stata 18.0 SE)

                    Comment


                    • #11
                      Thank you so much Carlo Lazzaro. I am very grateful for you help.

                      Comment


                      • #12
                        Originally posted by Carlo Lazzaro View Post
                        Ken:
                        as a second thought, what about:
                        Code:
                        xtset firm year
                        xtreg
                        y x var1 var2 var3 var4 var5 var6 i.year, fe vce(cluster firm)
                        Obviously, due to the -fe- machinery, adding -i.industry- would make sense if and only if some firms change industry as time goes by (but ity's pretty rare to happen).
                        In addition, clustering standard errors makes sense if you detect heteroskedasticity and/or autocorrelation in the idiosyncratic error distribution.



                        As a passionate student with self learning background of econometrics, I wish to seek for help on fixed effect regression command.

                        xtreg y x var1 var2 var3 var4 var5 var6 i.year i.indno, fe vce ( cluster firmno) .

                        I want to show firm fixed effects, industry fixed effects and year fixed effects.

                        Is my above command correct?

                        Comment


                        • #13
                          Lewis:
                          your code is basically correct.
                          I assume that you invoked non-default standard errors to take heteroskedasticity and/or autocorrelation into account.
                          As you are surely aware of, the -fe- machinery wipes out all time-invariant predictors: hence, if that were the case for -industry- the -fe- estimator will give you back no coefficient for that predictor.
                          Currently, there seems to be different views on this forum about the term -fixed effect- when it does not mention the -panelid-.
                          Another option that you may want to consider is the community-contributed command -reghdfe-.
                          Kind regards,
                          Carlo
                          (Stata 18.0 SE)

                          Comment


                          • #14
                            Originally posted by Carlo Lazzaro View Post
                            Lewis:
                            your code is basically correct.
                            I assume that you invoked non-default standard errors to take heteroskedasticity and/or autocorrelation into account.
                            As you are surely aware of, the -fe- machinery wipes out all time-invariant predictors: hence, if that were the case for -industry- the -fe- estimator will give you back no coefficient for that predictor.
                            Currently, there seems to be different views on this forum about the term -fixed effect- when it does not mention the -panelid-.
                            Another option that you may want to consider is the community-contributed command -reghdfe-.
                            Thank you so much Carlo. I will read further about community community-contributed command

                            Comment


                            • #15
                              Dear Stata Members
                              I have a similar problem mentioned in post 1 of this thread which is sign flipping of the variable of interest when I use 2 different fixed-effects models.
                              Let me elucidate my data and Stata output.
                              I have firms (which is my panel var) that are grouped under some industries (however there are many firms that move from industries to another during my sample period). My variable of interest is a macro variable (mpu-monetary policy uncertainty) hence the same for all firms during a particular year but different over a period of time. Hence I think it is not wise to include time dummies (I learned this from https://www.statalist.org/forums/forum/general-stata-discussion/general/1607218-fixed-effects-regressions-with-time-and-individual-fixed-effects?p=1607435#post1607435). My dependent variable is Inventory scaled by total assets.With this background, let me show what I did and what Stata told me
                              Code:
                               xtset id year
                                     panel variable:  id (unbalanced)
                                      time variable:  year, 2004 to 2019, but with gaps
                                              delta:  1 unit
                              
                              .
                              *Firm fixed effects with standard errors clustered at panel id (firm) level
                              
                              xtreg inven_ta_w  mpu tcred_ta_w casheq_ta_w size_w lever_w nw_ta_w ncfo_ta_w sgrowth_w pbitnet_ta_w fcfvol age i.rd_dum i.divid_dum ,fe vce (robust)
                              
                              Fixed-effects (within) regression               Number of obs     =     72,722
                              Group variable: id                              Number of groups  =     12,039
                              
                              R-sq:                                           Obs per group:
                                   within  = 0.1533                                         min =          1
                                   between = 0.0670                                         avg =        6.0
                                   overall = 0.0778                                         max =         15
                              
                                                                              F(13,12038)       =     185.38
                              corr(u_i, Xb)  = -0.0700                        Prob > F          =     0.0000
                              
                                                              (Std. Err. adjusted for 12,039 clusters in id)
                              ------------------------------------------------------------------------------
                                           |               Robust
                                inven_ta_w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                              -------------+----------------------------------------------------------------
                                       mpu |   .0052049   .0010175     5.12   0.000     .0032103    .0071994
                                tcred_ta_w |  -.2700547   .0072695   -37.15   0.000    -.2843041   -.2558053
                               casheq_ta_w |  -.1881892   .0081781   -23.01   0.000    -.2042196   -.1721588
                                    size_w |  -.0136602   .0015129    -9.03   0.000    -.0166257   -.0106947
                                   lever_w |   .0567783   .0075365     7.53   0.000     .0420056    .0715511
                                   nw_ta_w |   .0053919   .0077022     0.70   0.484    -.0097056    .0204894
                                 ncfo_ta_w |  -.1056387   .0041233   -25.62   0.000    -.1137209   -.0975564
                                 sgrowth_w |  -.0013366   .0004498    -2.97   0.003    -.0022182    -.000455
                              pbitnet_ta_w |   .1812956   .0076574    23.68   0.000     .1662857    .1963054
                                    fcfvol |  -.0413352   .0086443    -4.78   0.000    -.0582795    -.024391
                                       age |   .0481903   .0039537    12.19   0.000     .0404403    .0559402
                                  1.rd_dum |  -.0000452   .0018344    -0.02   0.980    -.0036409    .0035505
                               1.divid_dum |   .0026817   .0012104     2.22   0.027     .0003092    .0050542
                                     _cons |   .1283591   .0119812    10.71   0.000      .104874    .1518442
                              -------------+----------------------------------------------------------------
                                   sigma_u |  .15750585
                                   sigma_e |  .06248467
                                       rho |  .86401936   (fraction of variance due to u_i)
                              ------------------------------------------------------------------------------
                              
                              .
                              .*Firm fixed effects with standard errors clustered at industry level
                              . xtreg inven_ta_w  mpu tcred_ta_w casheq_ta_w size_w lever_w nw_ta_w ncfo_ta_w sgrowth_w pbitnet_ta_w fcfvol age i.rd_dum i.divid_dum ,fe cluster (ff48)
                              panels are not nested within clusters
                              r(498);
                              Based on the post (https://www.statalist.org/forums/forum/general-stata-discussion/general/1494694-panels-are-not-nested-within-clusters?p=1494698#post1494698) I realized that my panels (ids) are not nested within the clusters (industries), which makes this an inadmissible command. So somewhere in my data, there are many firms that appear in more than one industry.

                              Now, l tried industry fixed effects (Industry codes are named as ff48), and below is what I got
                              Code:
                               xtset ff48
                                     panel variable:  ff48 (unbalanced)
                              
                              . *Industry fixed effects with standard errors clustered at panel id level (here ff48)
                              . xtreg inven_ta_w  mpu tcred_ta_w casheq_ta_w size_w lever_w nw_ta_w ncfo_ta_w sgrowth_w pbitnet_ta_w fcfvol age i.rd_dum i.divid_dum ,fe vce (robust)
                              
                              Fixed-effects (within) regression               Number of obs     =     72,722
                              Group variable: ff48                            Number of groups  =         31
                              
                              R-sq:                                           Obs per group:
                                   within  = 0.1449                                         min =          7
                                   between = 0.2435                                         avg =    2,345.9
                                   overall = 0.1386                                         max =      9,257
                              
                                                                              F(13,30)          =     157.49
                              corr(u_i, Xb)  = 0.0290                         Prob > F          =     0.0000
                              
                                                                (Std. Err. adjusted for 31 clusters in ff48)
                              ------------------------------------------------------------------------------
                                           |               Robust
                                inven_ta_w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                              -------------+----------------------------------------------------------------
                                       mpu |  -.0049766   .0017111    -2.91   0.007    -.0084712   -.0014821
                                tcred_ta_w |  -.2613647    .033912    -7.71   0.000    -.3306221   -.1921072
                               casheq_ta_w |  -.2274132   .0320392    -7.10   0.000     -.292846   -.1619805
                                    size_w |  -.0124522   .0021318    -5.84   0.000    -.0168058   -.0080986
                                   lever_w |    .101408   .0331367     3.06   0.005     .0337339    .1690822
                                   nw_ta_w |  -.0384337   .0148845    -2.58   0.015     -.068832   -.0080354
                                 ncfo_ta_w |  -.2004953   .0195592   -10.25   0.000    -.2404405     -.16055
                                 sgrowth_w |  -.0077113   .0029755    -2.59   0.015    -.0137881   -.0016345
                              pbitnet_ta_w |   .3588916   .0297259    12.07   0.000     .2981832       .4196
                                    fcfvol |   .0936397    .038926     2.41   0.023     .0141423    .1731372
                                       age |   .0046165   .0035937     1.28   0.209    -.0027227    .0119558
                                  1.rd_dum |   .0013856   .0058916     0.24   0.816    -.0106466    .0134177
                               1.divid_dum |   -.004935   .0019465    -2.54   0.017    -.0089103   -.0009597
                                     _cons |   .2920689   .0196074    14.90   0.000     .2520253    .3321126
                              -------------+----------------------------------------------------------------
                                   sigma_u |  .07505752
                                   sigma_e |  .13608125
                                       rho |  .23325986   (fraction of variance due to u_i)
                              ------------------------------------------------------------------------------
                              
                              .
                              
                              . *Industry fixed effects with standard errors clustered at id (i.e firm) level
                              . xtreg inven_ta_w  mpu tcred_ta_w casheq_ta_w size_w lever_w nw_ta_w ncfo_ta_w sgrowth_w pbitnet_ta_w fcfvol age i.rd_dum i.divid_dum ,fe cluster (id)
                              panels are not nested within clusters
                              r(498);
                              Code:
                              distinct id ff48
                              
                                     |        Observations
                                     |      total   distinct
                              -------+----------------------
                                  id |     190285      24038
                                ff48 |     190285         32
                              So I have 24038 unique firms that are grouped into some 32 industries. My doubts are as follows
                              1. Since the variable of interest mpu flips its sign in two fixed-effect models (with same controls), what is the empirical justification/reason if theories postulate both relationships. I meanwhile first results suggests that owing to monetary policy uncertainty firms increase their inventory (say due to future supply bottlenecks), second says the opposite. Why is such sign reversals?
                              2. Professor Clyde Schechter in his post #2 suggests a " Three-level random-effects model". I also saw similar one here https://www.statalist.org/forums/forum/general-stata-discussion/general/1345493-interpretation-xt-mixed?p=1345531#post1345531. Based on my little readings in finance or economics, such models are not commonly used. Hence I am quite unsure how can we use the same setup with a two-way fixed effects model that makes sense. Also, can someone help to understand how a three-level random-effects model helps to get say better information about the relationships
                              3. Can the differences be attributed to something else, say like clustering, etc?
                              Last edited by lal mohan kumar; 10 May 2021, 01:18.

                              Comment

                              Working...
                              X