Announcement

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

  • panel data with firm, industry and year fixed effects

    Hello!

    I wonder is it possible to have firm, industry and year fixed effects all together in one model. I read https://www.statalist.org/forums/for...fects-together and I agree with the discussion that if putting all 3 fixed effects together
    Code:
    reg y x1 x2 x3 i.firm i.industry i.year
    the model would omit the industry fixed effects, because industry is totally determined by the firm variables appearing before it in the model. I tried that myself in my own model and indeed all the industries are omitted. And the model is incredibly long as it has fixed effects for each firm and there are more than 20,000 firms.

    Then I see another post https://www.statalist.org/forums/for...-fixed-effects that include firm fixed effects and industry-times-year fixed effects. Does that mean the 3 fixed effects can be put together as long as 2 of them are timed together? And what does the timed fixed effect mean?

    The code given in that post is
    Code:
    egen industryXyear = group(industry, year), label
    xtset firm
    xtreg y x1 x2 x3 i.industryXyear
    I tried this but when I run "egen industryXyear = group(industry, year), label" stata gives me "invalid syntax r(198)", so I think of another code using reg rather than xtreg. It indeed gives me some results, none of the fixed effects are omitted, but is that logically correct? And if so, how to interpret the industry-times-year fixed effects?
    Code:
    reg y x1 x2 x3 i.industry##i.year ,vce(cluster firm)

    Thanks a lot for any suggestions!

  • #2
    Flora:
    1) when it comes to multiple fixed effects (BTW: see the community-contributed module -reghdfe-), the first question is: why going that way?
    We know that, due to the -fe- machinery, time-invariant variables are wiped out;
    2) your -xtreg- code implies -re- specification, whereas your first one seems to go -fe- via -regress-;
    3) (the so called) time-fixed effect shoud be always included in the right-hand side of your -fe- regression equation. When adjusted for the other predictors, it measures the within panel variation due to each year your -timevar- is composed of;
    4) your egen code has a "small ant" (something that we use in Italian jargon to mean a trivial error), that is a comma in excess between the two grouped terms:
    Code:
    . set obs 1
    Number of observations (_N) was 0, now 1.
    
    . g industry=1
    
    . g year=2022
    
    . egen industryXyear=group( industry year ), label
    
    . list
    
         +----------------------------+
         | industry   year   indust~r |
         |----------------------------|
      1. |        1   2022     1 2022 |
         +----------------------------+
    Please note that this trivial error does not imply that you should switch from -xtreg- to -regress-.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlo,

      Thanks a lot for your quick reply! I didn't realize there shouldn't be a comma between industry and year. I think there is another place that is wrong, I should xtset firm year rather than just firm, because I have multiple years of observation for each firm. If I only xtset firm, stata says time variable not set r(111).

      Also, I wonder what does it mean by industry times year fixed effect? In terms of what it controls for, or what it achieves when use it. Sorry for being vague, I totally don't understand this two fixed effects timed together thing...

      Thanks!
      Last edited by Flora Yin; 13 Mar 2022, 03:31.

      Comment


      • #4
        Flora:
        1) you're corret about -xtset- ting your dataset with -panelid- only if Stata throws the -repeated time values- error message;
        2) basically, it boils down to an interaction aimed at investigating whether, when adjusted for the remaining predictors, time has different effect on industries as far as within panes variation is concerned.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thanks I understand now!

          Comment


          • #6
            It is incorrect to use both firm fixed and industry fixed effects since firm is the cross-sectional unit in your study.

            Using the within estimator or LSDV is equivelant in linear models, once you apply any of these approaches at the cross-sectional unit level, you will wipe out all cross-sectional-unit specific effects, this includes groups fixed effects such as industry, country, market and so on. Moreover, introducing more dummies reduces degree of freedom.

            Comment


            • #7
              Mohammed:
              Stata -xtreg,fe- generously takes care of all time-invariant variables just wiping them out.
              Therefore, if, as it often that case, firms do not change their industry during the timespan the panle stretches over, -i.industry- will be omitted.
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment


              • #8
                Originally posted by Carlo Lazzaro View Post
                Mohammed:
                Stata -xtreg,fe- generously takes care of all time-invariant variables just wiping them out.
                Therefore, if, as it often that case, firms do not change their industry during the timespan the panle stretches over, -i.industry- will be omitted.
                True for the ‘within estimator’, however, as you mentioned firms are not usually expected to change industry, particularly in short- to mid-term time period, which is the common case in corporate finance panel data econometrics and micro econometrics where panels are usually with large N and small to moderate T. Unless industry effect is of particular interest, I don’t think controlling for it worth it in this case.

                As for the specifications i.industry i.year (including dummies not the within estimator) and i.industry##i.year (interaction effect).

                Code:
                i.industry i.year 
                ‘it allows for industry-specific time-invariant differences between firms, and for period-specific shocks that are common to all industries and all firms, but not for industry-specific shocks. This assumes that all firms within a given industry respond homogeneously to the same time-varying shock αt

                Code:
                i.industry##i.year
                ‘Groups can be defined on more than one dimension simultaneously. For example, a common choice is to include industry × period fixed effects, sometimes referred to as interactive fixed effects (IFE). This allows for industry-specific shocks to yit, potentially correlated with xit. Think of changes in the regulatory environment, which may differentially affect different industries. This is more flexible than having both industry and period dummies.’

                See Verbeek (2021, p. 73) for further details on this topic and other relevant specifications.

                Verbeek, M. (2021). Panel Methods for Finance. In Panel Methods for Finance. De Gruyter. https://doi.org/10.1515/9783110660739

                Comment


                • #9
                  Mohammed:
                  interesting takes and references.
                  Thanks for sharing.
                  Kind regards,
                  Carlo
                  (Stata 19.0)

                  Comment

                  Working...
                  X