Announcement

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

  • Two-way fixed effects and multiple FEs (some questions to clear things up with the models used)

    Dear Stata Community:

    I am new to Stata, and have begun gathering information as to how to run fixed effects regression models. I believe the xtreg command and reghdfe syntax can accomplish this

    Let’s say my panel data has the following three main variables
    • Firm (e.g. 1,000 firms: Firm 1 to Firm 1000)
    • Year (firm-level data is collected over several years: 1980 to 2000)
    • Industry (i.e., different firms belong to a specific industry that does not change over time)
    My questions (relate to the Models shown at the bottom of this post) .... Please note I've gone through the several posts in the Stata forum, but have a few questions. Any help would be greatly appreciated.

    Question 1

    Are Models 5 and Models 6 the same?


    In particular, is the interaction variable (industry# year) in Model 5 the SAME as the group variable (industry_year) in Model 6?

    From my understanding:
    • Models 5 and Model 6 DO CONTROL for firm fixed effects (FE)
    • Models 5 and 6 do NOT control for year fixed effects
    However:
    • Models 5 controls for the interaction variable: industry & year (i.e. i.industry#i.year)
    • Model 6 controls for the group variable (industry_year)
    Question 2

    For both Models 5 and Model 6, can I include i.year (in Model 5a) and year (in Model 6a) to control for year fixed effects? That is:


    Model 5a
    xtset firm;
    xtreg dependent_variable independent_variables i.industry#i.year i.year, fe;

    Model 6a

    egen industry_year = group(industry year);
    reghdfe dependent_variable independent_variables, absorb(firm year industry_year);

    Question 3

    Should the panelid (in xtset <panelid>) be ideally always set to the highest aggregate level? (or that just depends on the research question?)



    Question 4

    Why do researchers run an industry and year fixed effects model (e.g., Model 3 and Model 4) when a fixed and year fixed effects model (i.e, Models 1 and 2) is much superior?

    (assuming that the dataset contains three-level data structure: repeated observations over time nested within firms which are nested within industries)


    That is, since industry is time-invariant within firms, the firm fixed effect includes the industry fixed effect, so the firm fixed effects model is the more robust specification (controls for more unobservable factors including time invariant industry-level unobservable).

    As I’m new to stata and multiple fixed effects regression models, forgive my ignorance in the above questions

    I look forward to hearing from the STATA community for any great insights.

    Thanks,
    Reuben

    A: Two-way fixed effects model (with firm and year fixed effects)

    If I wanted to run a regression with firm and year fixed effects, I would run the below:

    Model 1 (using xtreg)

    xtset firm year
    xtreg dependent_variable independent_variables i.year, fe;

    Model 2 (using reghdfe)

    reghdfe dependent_variable independent_variables, absorb(firm year);

    B: Two-way fixed effects model (with industry and year fixed effects)

    Model 3 (using xtreg)

    xtset industry year
    xtreg dependent_variable independent_variables i.year, fe;


    Model 4 (using reghdfe)

    reghdfe dependent_variable independent_variables, absorb(industry year);

    C: Multiple fixed effects model (with industry-year FE and firm FE)

    Model 5 (using xtreg)

    xtset firm;
    xtreg dependent_variable independent_variables i.industry#i.year, fe;


    Model 6 (using reghdfe)

    egen industry_year = group(industry year);

    reghdfe dependent_variable independent_variables, absorb(firm industry_year);



  • #2
    Reuben:
    welcome to this forum.
    Please note that being straight to the point increases your chances of receiving (more) helpful replies.
    That said, as the -fe- machinery wipes out time-invariant predictors, there's no scope in focusing on -i.industry- if firms are not expected to change it during the timespan the panel stretches over.
    As far as the comparison between -xtreg,fe. and the community-contributed command -reghdfe- (as you're kindly requested to define it, for reasons that are well explained in the FAQ), in my opinion most depends on whther you want to numerically retrieve more than one fixed effect or not; in the latter case I would go -xtreg,fe-.
    As an aside, is a good habit to select the regression model (and the predictors) that gives a fair and true view of the datagenerating process you're interested in.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thanks Carlo for your reply and suggestion. I will repost this question and keep in mind their brevity. best, Reuben

      Before I do, would you happen to know whether Model 5 and Model 6 in Stata is effectively the same?

      ie, using an interaction dummy versus a group dummy with the same variables give the same results?

      thanks,
      reuben

      Comment


      • #4
        Reuben:
        no they aren't (by the way: please note that one of the best way to learn Stata is to experiment yourself with different regression models amd see whether or not they reach the same results), as you can see from the following toy-example:
        Code:
        . use "https://www.stata-press.com/data/r16/nlswork.dta"
        (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
        
        . xtreg ln_wage c.age##c.age i.ind_code##i.year, fe
        note: 2.ind_code#70.year identifies no observations in the sample
        
        Fixed-effects (within) regression               Number of obs     =     28,169
        Group variable: idcode                          Number of groups  =      4,694
        
        R-sq:                                           Obs per group:
             within  = 0.1849                                         min =          1
             between = 0.2144                                         avg =        6.0
             overall = 0.1758                                         max =         15
        
                                                        F(180,23295)      =      29.36
        corr(u_i, Xb)  = 0.0933                         Prob > F          =     0.0000
        
        -------------------------------------------------------------------------------
              ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        --------------+----------------------------------------------------------------
                  age |   .0678001   .0105313     6.44   0.000     .0471581    .0884422
                      |
          c.age#c.age |  -.0008755   .0000598   -14.65   0.000    -.0009927   -.0007583
                      |
             ind_code |
                   2  |   .5242965   .3354356     1.56   0.118    -.1331794    1.181772
                   3  |   .0238958   .1638664     0.15   0.884    -.2972931    .3450848
                   4  |   .3232319   .1018911     3.17   0.002     .1235187    .5229451
                   5  |   .3065083   .1076659     2.85   0.004      .095476    .5175407
                   6  |   .0745627   .1026394     0.73   0.468    -.1266172    .2757427
                   7  |   .1605459   .1057578     1.52   0.129    -.0467464    .3678383
                   8  |   .3435302   .1172027     2.93   0.003     .1138053    .5732551
                   9  |  -.2034022   .1048539    -1.94   0.052    -.4089227    .0021184
                  10  |   .1119328   .1338517     0.84   0.403    -.1504254     .374291
                  11  |   .1579645   .1025897     1.54   0.124     -.043118     .359047
                  12  |   .2075648   .1077347     1.93   0.054    -.0036024    .4187319
                      |
                 year |
                  69  |  -.2194808   .1744729    -1.26   0.208    -.5614592    .1224976
                  70  |   .0929571   .1301992     0.71   0.475    -.1622419    .3481561
                  71  |   .1716137   .1282638     1.34   0.181    -.0797917    .4230191
                  72  |  -.0650669   .1366749    -0.48   0.634    -.3329588    .2028249
                  73  |   .1278254   .1302777     0.98   0.327    -.1275275    .3831784
                  75  |   .2509468   .1469046     1.71   0.088    -.0369958    .5388894
                  77  |   .1373656   .1543122     0.89   0.373    -.1650964    .4398275
                  78  |   .1318045   .1532987     0.86   0.390    -.1686711    .4322801
                  80  |   .1902107   .1823117     1.04   0.297    -.1671323    .5475537
                  82  |   -.010921   .1916784    -0.06   0.955    -.3866232    .3647813
                  83  |   .1073451   .1931848     0.56   0.578    -.2713099        .486
                  85  |   .1318158    .212546     0.62   0.535    -.2847884      .54842
                  87  |    .195502   .2285928     0.86   0.392     -.252555     .643559
                  88  |   .1614185   .2377185     0.68   0.497    -.3045254    .6273625
                      |
        ind_code#year |
                2 69  |   .1476546   .4753952     0.31   0.756    -.7841514    1.079461
                2 70  |          0  (empty)
                2 71  |  -.3976327   .3877632    -1.03   0.305    -1.157674    .3624087
                2 72  |  -.1391724   .4089538    -0.34   0.734    -.9407488     .662404
                2 73  |  -.2630904   .3629585    -0.72   0.469     -.974513    .4483322
                2 75  |  -.6278997   .3720496    -1.69   0.091    -1.357141     .101342
                2 77  |  -.3360452   .3667263    -0.92   0.359    -1.054853    .3827625
                2 78  |  -.3053323   .3773116    -0.81   0.418    -1.044888    .4342233
                2 80  |  -.3752881   .3826321    -0.98   0.327    -1.125272    .3746959
                2 82  |   .0243554   .3697193     0.07   0.947    -.7003187    .7490296
                2 83  |  -.2147142   .3696623    -0.58   0.561    -.9392767    .5098484
                2 85  |  -.7367724   .3802667    -1.94   0.053     -1.48212    .0085753
                2 87  |  -.5152108   .3908816    -1.32   0.187    -1.281365    .2509429
                2 88  |   .2106637   .3782887     0.56   0.578    -.5308071    .9521346
                3 69  |   .5865969   .2381167     2.46   0.014     .1198724    1.053321
                3 70  |   .1839732    .201504     0.91   0.361    -.2109879    .5789343
                3 71  |   .0773021   .2098197     0.37   0.713    -.3339583    .4885625
                3 72  |   .3279363   .2053424     1.60   0.110    -.0745483    .7304209
                3 73  |   .1310005    .194042     0.68   0.500    -.2493346    .5113357
                3 75  |  -.1047711   .2038146    -0.51   0.607    -.5042611     .294719
                3 77  |  -.0019935    .200416    -0.01   0.992    -.3948221     .390835
                3 78  |    .072329   .1978007     0.37   0.715    -.3153733    .4600314
                3 80  |  -.0685413   .2057433    -0.33   0.739    -.4718117     .334729
                3 82  |   .1843802   .1961812     0.94   0.347    -.2001479    .5689083
                3 83  |   .0773066   .1889594     0.41   0.682    -.2930663    .4476795
                3 85  |   .1222879   .1954278     0.63   0.531    -.2607634    .5053392
                3 87  |   .0027804   .1949259     0.01   0.989    -.3792871    .3848479
                3 88  |    .252597   .1914864     1.32   0.187     -.122729    .6279229
                4 69  |   .2735107   .1758809     1.56   0.120    -.0712275    .6182489
                4 70  |  -.0716608   .1309497    -0.55   0.584    -.3283309    .1850093
                4 71  |  -.1541352   .1271309    -1.21   0.225    -.4033202    .0950498
                4 72  |   .0449545   .1332494     0.34   0.736    -.2162232    .3061321
                4 73  |  -.1361036   .1231202    -1.11   0.269    -.3774274    .1052201
                4 75  |  -.3130424   .1325174    -2.36   0.018    -.5727852   -.0532995
                4 77  |  -.1833257   .1290375    -1.42   0.155    -.4362477    .0695964
                4 78  |  -.1507817   .1204641    -1.25   0.211    -.3868991    .0853358
                4 80  |  -.2487581   .1414298    -1.76   0.079    -.5259699    .0284537
                4 82  |  -.0393479   .1356864    -0.29   0.772    -.3053021    .2266062
                4 83  |  -.1506802   .1272232    -1.18   0.236     -.400046    .0986856
                4 85  |   -.168768   .1345711    -1.25   0.210    -.4325363    .0950003
                4 87  |  -.2113079   .1348651    -1.57   0.117    -.4756524    .0530365
                4 88  |   -.121716   .1305912    -0.93   0.351    -.3776834    .1342514
                5 69  |   .1991809   .1815765     1.10   0.273    -.1567211    .5550829
                5 70  |   -.132942   .1380174    -0.96   0.335    -.4034651    .1375812
                5 71  |   -.168565   .1339316    -1.26   0.208    -.4310798    .0939499
                5 72  |   .1404348    .139994     1.00   0.316    -.1339627    .4148322
                5 73  |  -.0605021   .1305905    -0.46   0.643    -.3164681    .1954639
                5 75  |  -.2103342   .1398882    -1.50   0.133    -.4845243    .0638558
                5 77  |  -.0368888   .1360609    -0.27   0.786    -.3035771    .2297996
                5 78  |  -.0005433   .1281851    -0.00   0.997    -.2517945    .2507079
                5 80  |  -.0599294   .1479098    -0.41   0.685    -.3498423    .2299836
                5 82  |   .0777538   .1423233     0.55   0.585    -.2012092    .3567168
                5 83  |   .0336184   .1344339     0.25   0.803    -.2298808    .2971176
                5 85  |   .0791732   .1412221     0.56   0.575    -.1976315    .3559779
                5 87  |   .0494601   .1414954     0.35   0.727    -.2278801    .3268003
                5 88  |   .1063605   .1384364     0.77   0.442     -.164984    .3777049
                6 69  |     .27411   .1766925     1.55   0.121    -.0722188    .6204389
                6 70  |  -.0872568   .1317765    -0.66   0.508    -.3455475    .1710339
                6 71  |  -.1519196    .127902    -1.19   0.235    -.4026159    .0987768
                6 72  |   .0959262   .1338363     0.72   0.474    -.1664017    .3582541
                6 73  |  -.0935242   .1237924    -0.76   0.450    -.3361654     .149117
                6 75  |  -.2952886   .1332919    -2.22   0.027    -.5565495   -.0340277
                6 77  |  -.1377196   .1297668    -1.06   0.289    -.3920711    .1166318
                6 78  |  -.1022424   .1212761    -0.84   0.399    -.3399514    .1354667
                6 80  |  -.1322529   .1424232    -0.93   0.353    -.4114118     .146906
                6 82  |   .0341174   .1364337     0.25   0.803    -.2333018    .3015365
                6 83  |  -.1214441   .1280027    -0.95   0.343    -.3723379    .1294497
                6 85  |  -.1058466   .1352797    -0.78   0.434    -.3710037    .1593105
                6 87  |   -.183314   .1355221    -1.35   0.176    -.4489463    .0823183
                6 88  |  -.0565712   .1313127    -0.43   0.667    -.3139527    .2008103
                7 69  |   .2437428   .1795569     1.36   0.175    -.1082006    .5956863
                7 70  |  -.0145174   .1352789    -0.11   0.915     -.279673    .2506381
                7 71  |  -.0638662   .1313138    -0.49   0.627    -.3212499    .1935176
                7 72  |   .1738727    .137373     1.27   0.206    -.0953875    .4431329
                7 73  |  -.0586953   .1274436    -0.46   0.645    -.3084932    .1911026
                7 75  |   -.203563   .1367371    -1.49   0.137    -.4715767    .0644507
                7 77  |  -.0854836   .1331687    -0.64   0.521     -.346503    .1755357
                7 78  |  -.0662867   .1248573    -0.53   0.595    -.3110153    .1784418
                7 80  |  -.1542685   .1453781    -1.06   0.289    -.4392191    .1306822
                7 82  |   .0366306   .1395086     0.26   0.793    -.2368154    .3100767
                7 83  |  -.0611979   .1313059    -0.47   0.641    -.3185661    .1961703
                7 85  |  -.0017256   .1385332    -0.01   0.990    -.2732597    .2698085
                7 87  |  -.0431373   .1384795    -0.31   0.755    -.3145662    .2282917
                7 88  |   .0847515   .1344923     0.63   0.529    -.1788624    .3483653
                8 69  |   .0825073   .1919233     0.43   0.667    -.2936749    .4586895
                8 70  |  -.2353715   .1497128    -1.57   0.116    -.5288184    .0580754
                8 71  |  -.3396404   .1464956    -2.32   0.020    -.6267815   -.0524994
                8 72  |  -.1105752   .1497383    -0.74   0.460    -.4040722    .1829217
                8 73  |  -.2773116     .14085    -1.97   0.049    -.5533868   -.0012363
                8 75  |  -.5183904   .1506472    -3.44   0.001    -.8136688   -.2231119
                8 77  |  -.3739331   .1471087    -2.54   0.011    -.6622759   -.0855904
                8 78  |  -.2894394   .1401333    -2.07   0.039      -.56411   -.0147688
                8 80  |  -.4728497   .1578936    -2.99   0.003    -.7823315   -.1633678
                8 82  |  -.1971513   .1525991    -1.29   0.196    -.4962555    .1019529
                8 83  |  -.3500584   .1451575    -2.41   0.016    -.6345767   -.0655401
                8 85  |  -.2560926   .1496892    -1.71   0.087    -.5494932    .0373081
                8 87  |  -.4159189   .1499648    -2.77   0.006    -.7098597   -.1219781
                8 88  |  -.3064932   .1459851    -2.10   0.036    -.5926336   -.0203527
                9 69  |   .3299893   .1803608     1.83   0.067    -.0235298    .6835084
                9 70  |  -.0231599   .1347942    -0.17   0.864    -.2873655    .2410456
                9 71  |  -.0250784   .1307968    -0.19   0.848    -.2814487    .2312918
                9 72  |   .2005993   .1371623     1.46   0.144    -.0682478    .4694464
                9 73  |  -.0341334    .127172    -0.27   0.788    -.2833988    .2151321
                9 75  |  -.0829135   .1375615    -0.60   0.547    -.3525432    .1867161
                9 77  |   .0777244   .1335767     0.58   0.561    -.1840947    .3395436
                9 78  |   .1047841   .1258463     0.83   0.405    -.1418828    .3514511
                9 80  |   .0437378   .1469431     0.30   0.766    -.2442802    .3317559
                9 82  |   .1960192   .1403707     1.40   0.163    -.0791165     .471155
                9 83  |   .0601735   .1326144     0.45   0.650    -.1997595    .3201064
                9 85  |   .1240884   .1400423     0.89   0.376    -.1504037    .3985805
                9 87  |   .0025405   .1407488     0.02   0.986    -.2733365    .2784175
                9 88  |   .1095095   .1362618     0.80   0.422    -.1575727    .3765917
               10 69  |   .1427868   .2281934     0.63   0.532    -.3044872    .5900608
               10 70  |  -.0632808   .1860545    -0.34   0.734    -.4279599    .3013983
               10 71  |   -.047924   .1898909    -0.25   0.801    -.4201227    .3242746
               10 72  |   .1357275   .1837038     0.74   0.460    -.2243441     .495799
               10 73  |  -.1803816   .1714186    -1.05   0.293    -.5163734    .1556102
               10 75  |  -.1628151   .1798517    -0.91   0.365    -.5153364    .1897061
               10 77  |  -.0864493   .1718997    -0.50   0.615    -.4233841    .2504854
               10 78  |   .0294061   .1676043     0.18   0.861    -.2991095    .3579216
               10 80  |  -.2301376   .1813364    -1.27   0.204    -.5855688    .1252936
               10 82  |  -.0061144   .1751445    -0.03   0.972    -.3494092    .3371805
               10 83  |   .0494868   .1717356     0.29   0.773    -.2871263    .3860998
               10 85  |   .0651157   .1860532     0.35   0.726    -.2995609    .4297923
               10 87  |  -.2468872   .1820171    -1.36   0.175    -.6036527    .1098782
               10 88  |  -.0172385   .1749455    -0.10   0.922    -.3601433    .3256662
               11 69  |   .2954905    .176374     1.68   0.094    -.0502141    .6411952
               11 70  |  -.0592597   .1314488    -0.45   0.652     -.316908    .1983885
               11 71  |   -.087225   .1276219    -0.68   0.494    -.3373724    .1629223
               11 72  |   .1309269   .1335771     0.98   0.327     -.130893    .3927468
               11 73  |  -.0868455   .1234816    -0.70   0.482    -.3288776    .1551865
               11 75  |  -.2633748   .1328871    -1.98   0.047    -.5238423   -.0029073
               11 77  |  -.1605356   .1292177    -1.24   0.214    -.4138107    .0927396
               11 78  |  -.1387058   .1205775    -1.15   0.250    -.3750457    .0976341
               11 80  |  -.2500322   .1415599    -1.77   0.077     -.527499    .0274346
               11 82  |  -.0361886   .1358601    -0.27   0.790    -.3024833    .2301061
               11 83  |  -.1245243   .1272809    -0.98   0.328    -.3740033    .1249548
               11 85  |  -.1218121   .1344516    -0.91   0.365    -.3853461    .1417218
               11 87  |  -.1645557   .1346131    -1.22   0.222    -.4284062    .0992948
               11 88  |  -.0867714   .1304274    -0.67   0.506    -.3424177    .1688749
               12 69  |   .3307019   .1823174     1.81   0.070    -.0266522     .688056
               12 70  |   -.010282   .1386124    -0.07   0.941    -.2819715    .2614074
               12 71  |   -.044383   .1344456    -0.33   0.741    -.3079052    .2191392
               12 72  |   .2017759   .1396484     1.44   0.149    -.0719442    .4754961
               12 73  |  -.0287431   .1306474    -0.22   0.826    -.2848205    .2273344
               12 75  |  -.2233631   .1387102    -1.61   0.107    -.4952443    .0485181
               12 77  |   -.079215   .1352447    -0.59   0.558    -.3443035    .1858735
               12 78  |  -.1138058   .1276443    -0.89   0.373     -.363997    .1363854
               12 80  |  -.1517652   .1473248    -1.03   0.303    -.4405315    .1370012
               12 82  |   .0401467   .1415688     0.28   0.777    -.2373374    .3176308
               12 83  |   .0032639   .1336612     0.02   0.981    -.2587208    .2652486
               12 85  |  -.0144426   .1400393    -0.10   0.918    -.2889288    .2600437
               12 87  |  -.0668112   .1401405    -0.48   0.634    -.3414958    .2078734
               12 88  |   .0425139   .1361683     0.31   0.755    -.2243849    .3094127
                      |
                _cons |   .2857499   .2202572     1.30   0.195    -.1459688    .7174685
        --------------+----------------------------------------------------------------
              sigma_u |  .38100717
              sigma_e |  .29051082
                  rho |  .63236002   (fraction of variance due to u_i)
        -------------------------------------------------------------------------------
        F test that all u_i=0: F(4693, 23295) = 7.64                 Prob > F = 0.0000
        
        . egen new_absorb=group( ind_code year )
        (341 missing values generated)
        
        . reghdfe ln_wage c.age##c.age , abs( idcode new_absorb)
        (dropped 550 singleton observations)
        (converged in 16 iterations)
        
        HDFE Linear regression                            Number of obs   =     27,619
        Absorbing 2 HDFE groups                           F(   2,  23295) =     108.49
                                                          Prob > F        =     0.0000
                                                          R-squared       =     0.6864
                                                          Adj R-squared   =     0.6282
                                                          Within R-sq.    =     0.0092
                                                          Root MSE        =     0.2905
        
        ------------------------------------------------------------------------------
             ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
                 age |   .0678001   .0105313     6.44   0.000     .0471581    .0884422
                     |
         c.age#c.age |  -.0008755   .0000598   -14.65   0.000    -.0009927   -.0007583
        -------------+----------------------------------------------------------------
            Absorbed |    F(4321, 23295) =     10.303   0.000             (Joint test)
        ------------------------------------------------------------------------------
        
        Absorbed degrees of freedom:
        ---------------------------------------------------------------+
         Absorbed FE |  Num. Coefs.  =   Categories  -   Redundant     | 
        -------------+-------------------------------------------------|
              idcode |         4146            4146              0     | 
          new_absorb |          176             177              1     | 
        ---------------------------------------------------------------+
        
        .
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thanks very much for your help. I'll keep on doing more experimenting on Stata. It's a great application for regressions compared to SAS

          At this stage, I'm just trying to figure out regressions with more than 2-way FEs and interpreting the results.
          I'm really looking for an example of multiple FEs that is done by hand ... so i can then replicate it using STATA commands. Yet to find such an example!

          For example, if you include

          - firm fixed effects &
          - industry-year fixed effects

          I interpret this to mean:

          Firm fixed effects control for all characteristics of firm i that do not change over time (Fixed effect 1)
          Industry-year fixed effects control for all characteristics of industry-year i that do not change over time (Fixed effect 2)

          I wonder whether if you included a year fixed effects, where that would be allowable or whether that's already accounted for in the grouping variable (industry-year)?
          Note: I understand that failure to include year fixed effects pick up the influence of aggregate trends, which have nothing to do with causal relationships

          I'll keep on doing some investigating

          Thanks for running the 2 regressions (Model 5 and model 6), the coefficients on the main X variables are the same BUT you get the coefficients on the dummy variables, but don't get a coefficient on the new_absorb variable.

          One difference I note when you ran the above example is that the "firm" variable was not included in the regression syntax. By including "firm" as a fixed effects, any industry dummy included in the regression would drop off because it's time-invariant. (i.e. firms rarely change industries over time). I suspect that's why they included an interaction term (industry*year) in the model 5 regression.

          Model 5 (using xtreg)

          xtset firm;
          xtreg dependent_variable independent_variables i.industry#i.year, fe;

          Model 6 (using reghdfe)

          egen industry_year = group(industry year);

          reghdfe dependent_variable independent_variables, absorb(firm industry_year);


          Thanks for all your help. It's super appreciated! .... and i hope you have a great new year

          Comment


          • #6
            Reuben:
            my preference goes out to your Model 5, as it allows you to -testparm- the joint statistical significance of the main conditional effect and the interaction:
            Code:
            . use "https://www.stata-press.com/data/r16/nlswork.dta"
            (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
            
            . xtreg ln_wage c.age##c.age i.ind_code##i.year, fe
            note: 2.ind_code#70.year identifies no observations in the sample
            
            Fixed-effects (within) regression               Number of obs     =     28,169
            Group variable: idcode                          Number of groups  =      4,694
            
            R-sq:                                           Obs per group:
                 within  = 0.1849                                         min =          1
                 between = 0.2144                                         avg =        6.0
                 overall = 0.1758                                         max =         15
            
                                                            F(180,23295)      =      29.36
            corr(u_i, Xb)  = 0.0933                         Prob > F          =     0.0000
            
            -------------------------------------------------------------------------------
                  ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
            --------------+----------------------------------------------------------------
                      age |   .0678001   .0105313     6.44   0.000     .0471581    .0884422
                          |
              c.age#c.age |  -.0008755   .0000598   -14.65   0.000    -.0009927   -.0007583
                          |
                 ind_code |
                       2  |   .5242965   .3354356     1.56   0.118    -.1331794    1.181772
                       3  |   .0238958   .1638664     0.15   0.884    -.2972931    .3450848
                       4  |   .3232319   .1018911     3.17   0.002     .1235187    .5229451
                       5  |   .3065083   .1076659     2.85   0.004      .095476    .5175407
                       6  |   .0745627   .1026394     0.73   0.468    -.1266172    .2757427
                       7  |   .1605459   .1057578     1.52   0.129    -.0467464    .3678383
                       8  |   .3435302   .1172027     2.93   0.003     .1138053    .5732551
                       9  |  -.2034022   .1048539    -1.94   0.052    -.4089227    .0021184
                      10  |   .1119328   .1338517     0.84   0.403    -.1504254     .374291
                      11  |   .1579645   .1025897     1.54   0.124     -.043118     .359047
                      12  |   .2075648   .1077347     1.93   0.054    -.0036024    .4187319
                          |
                     year |
                      69  |  -.2194808   .1744729    -1.26   0.208    -.5614592    .1224976
                      70  |   .0929571   .1301992     0.71   0.475    -.1622419    .3481561
                      71  |   .1716137   .1282638     1.34   0.181    -.0797917    .4230191
                      72  |  -.0650669   .1366749    -0.48   0.634    -.3329588    .2028249
                      73  |   .1278254   .1302777     0.98   0.327    -.1275275    .3831784
                      75  |   .2509468   .1469046     1.71   0.088    -.0369958    .5388894
                      77  |   .1373656   .1543122     0.89   0.373    -.1650964    .4398275
                      78  |   .1318045   .1532987     0.86   0.390    -.1686711    .4322801
                      80  |   .1902107   .1823117     1.04   0.297    -.1671323    .5475537
                      82  |   -.010921   .1916784    -0.06   0.955    -.3866232    .3647813
                      83  |   .1073451   .1931848     0.56   0.578    -.2713099        .486
                      85  |   .1318158    .212546     0.62   0.535    -.2847884      .54842
                      87  |    .195502   .2285928     0.86   0.392     -.252555     .643559
                      88  |   .1614185   .2377185     0.68   0.497    -.3045254    .6273625
                          |
            ind_code#year |
                    2 69  |   .1476546   .4753952     0.31   0.756    -.7841514    1.079461
                    2 70  |          0  (empty)
                    2 71  |  -.3976327   .3877632    -1.03   0.305    -1.157674    .3624087
                    2 72  |  -.1391724   .4089538    -0.34   0.734    -.9407488     .662404
                    2 73  |  -.2630904   .3629585    -0.72   0.469     -.974513    .4483322
                    2 75  |  -.6278997   .3720496    -1.69   0.091    -1.357141     .101342
                    2 77  |  -.3360452   .3667263    -0.92   0.359    -1.054853    .3827625
                    2 78  |  -.3053323   .3773116    -0.81   0.418    -1.044888    .4342233
                    2 80  |  -.3752881   .3826321    -0.98   0.327    -1.125272    .3746959
                    2 82  |   .0243554   .3697193     0.07   0.947    -.7003187    .7490296
                    2 83  |  -.2147142   .3696623    -0.58   0.561    -.9392767    .5098484
                    2 85  |  -.7367724   .3802667    -1.94   0.053     -1.48212    .0085753
                    2 87  |  -.5152108   .3908816    -1.32   0.187    -1.281365    .2509429
                    2 88  |   .2106637   .3782887     0.56   0.578    -.5308071    .9521346
                    3 69  |   .5865969   .2381167     2.46   0.014     .1198724    1.053321
                    3 70  |   .1839732    .201504     0.91   0.361    -.2109879    .5789343
                    3 71  |   .0773021   .2098197     0.37   0.713    -.3339583    .4885625
                    3 72  |   .3279363   .2053424     1.60   0.110    -.0745483    .7304209
                    3 73  |   .1310005    .194042     0.68   0.500    -.2493346    .5113357
                    3 75  |  -.1047711   .2038146    -0.51   0.607    -.5042611     .294719
                    3 77  |  -.0019935    .200416    -0.01   0.992    -.3948221     .390835
                    3 78  |    .072329   .1978007     0.37   0.715    -.3153733    .4600314
                    3 80  |  -.0685413   .2057433    -0.33   0.739    -.4718117     .334729
                    3 82  |   .1843802   .1961812     0.94   0.347    -.2001479    .5689083
                    3 83  |   .0773066   .1889594     0.41   0.682    -.2930663    .4476795
                    3 85  |   .1222879   .1954278     0.63   0.531    -.2607634    .5053392
                    3 87  |   .0027804   .1949259     0.01   0.989    -.3792871    .3848479
                    3 88  |    .252597   .1914864     1.32   0.187     -.122729    .6279229
                    4 69  |   .2735107   .1758809     1.56   0.120    -.0712275    .6182489
                    4 70  |  -.0716608   .1309497    -0.55   0.584    -.3283309    .1850093
                    4 71  |  -.1541352   .1271309    -1.21   0.225    -.4033202    .0950498
                    4 72  |   .0449545   .1332494     0.34   0.736    -.2162232    .3061321
                    4 73  |  -.1361036   .1231202    -1.11   0.269    -.3774274    .1052201
                    4 75  |  -.3130424   .1325174    -2.36   0.018    -.5727852   -.0532995
                    4 77  |  -.1833257   .1290375    -1.42   0.155    -.4362477    .0695964
                    4 78  |  -.1507817   .1204641    -1.25   0.211    -.3868991    .0853358
                    4 80  |  -.2487581   .1414298    -1.76   0.079    -.5259699    .0284537
                    4 82  |  -.0393479   .1356864    -0.29   0.772    -.3053021    .2266062
                    4 83  |  -.1506802   .1272232    -1.18   0.236     -.400046    .0986856
                    4 85  |   -.168768   .1345711    -1.25   0.210    -.4325363    .0950003
                    4 87  |  -.2113079   .1348651    -1.57   0.117    -.4756524    .0530365
                    4 88  |   -.121716   .1305912    -0.93   0.351    -.3776834    .1342514
                    5 69  |   .1991809   .1815765     1.10   0.273    -.1567211    .5550829
                    5 70  |   -.132942   .1380174    -0.96   0.335    -.4034651    .1375812
                    5 71  |   -.168565   .1339316    -1.26   0.208    -.4310798    .0939499
                    5 72  |   .1404348    .139994     1.00   0.316    -.1339627    .4148322
                    5 73  |  -.0605021   .1305905    -0.46   0.643    -.3164681    .1954639
                    5 75  |  -.2103342   .1398882    -1.50   0.133    -.4845243    .0638558
                    5 77  |  -.0368888   .1360609    -0.27   0.786    -.3035771    .2297996
                    5 78  |  -.0005433   .1281851    -0.00   0.997    -.2517945    .2507079
                    5 80  |  -.0599294   .1479098    -0.41   0.685    -.3498423    .2299836
                    5 82  |   .0777538   .1423233     0.55   0.585    -.2012092    .3567168
                    5 83  |   .0336184   .1344339     0.25   0.803    -.2298808    .2971176
                    5 85  |   .0791732   .1412221     0.56   0.575    -.1976315    .3559779
                    5 87  |   .0494601   .1414954     0.35   0.727    -.2278801    .3268003
                    5 88  |   .1063605   .1384364     0.77   0.442     -.164984    .3777049
                    6 69  |     .27411   .1766925     1.55   0.121    -.0722188    .6204389
                    6 70  |  -.0872568   .1317765    -0.66   0.508    -.3455475    .1710339
                    6 71  |  -.1519196    .127902    -1.19   0.235    -.4026159    .0987768
                    6 72  |   .0959262   .1338363     0.72   0.474    -.1664017    .3582541
                    6 73  |  -.0935242   .1237924    -0.76   0.450    -.3361654     .149117
                    6 75  |  -.2952886   .1332919    -2.22   0.027    -.5565495   -.0340277
                    6 77  |  -.1377196   .1297668    -1.06   0.289    -.3920711    .1166318
                    6 78  |  -.1022424   .1212761    -0.84   0.399    -.3399514    .1354667
                    6 80  |  -.1322529   .1424232    -0.93   0.353    -.4114118     .146906
                    6 82  |   .0341174   .1364337     0.25   0.803    -.2333018    .3015365
                    6 83  |  -.1214441   .1280027    -0.95   0.343    -.3723379    .1294497
                    6 85  |  -.1058466   .1352797    -0.78   0.434    -.3710037    .1593105
                    6 87  |   -.183314   .1355221    -1.35   0.176    -.4489463    .0823183
                    6 88  |  -.0565712   .1313127    -0.43   0.667    -.3139527    .2008103
                    7 69  |   .2437428   .1795569     1.36   0.175    -.1082006    .5956863
                    7 70  |  -.0145174   .1352789    -0.11   0.915     -.279673    .2506381
                    7 71  |  -.0638662   .1313138    -0.49   0.627    -.3212499    .1935176
                    7 72  |   .1738727    .137373     1.27   0.206    -.0953875    .4431329
                    7 73  |  -.0586953   .1274436    -0.46   0.645    -.3084932    .1911026
                    7 75  |   -.203563   .1367371    -1.49   0.137    -.4715767    .0644507
                    7 77  |  -.0854836   .1331687    -0.64   0.521     -.346503    .1755357
                    7 78  |  -.0662867   .1248573    -0.53   0.595    -.3110153    .1784418
                    7 80  |  -.1542685   .1453781    -1.06   0.289    -.4392191    .1306822
                    7 82  |   .0366306   .1395086     0.26   0.793    -.2368154    .3100767
                    7 83  |  -.0611979   .1313059    -0.47   0.641    -.3185661    .1961703
                    7 85  |  -.0017256   .1385332    -0.01   0.990    -.2732597    .2698085
                    7 87  |  -.0431373   .1384795    -0.31   0.755    -.3145662    .2282917
                    7 88  |   .0847515   .1344923     0.63   0.529    -.1788624    .3483653
                    8 69  |   .0825073   .1919233     0.43   0.667    -.2936749    .4586895
                    8 70  |  -.2353715   .1497128    -1.57   0.116    -.5288184    .0580754
                    8 71  |  -.3396404   .1464956    -2.32   0.020    -.6267815   -.0524994
                    8 72  |  -.1105752   .1497383    -0.74   0.460    -.4040722    .1829217
                    8 73  |  -.2773116     .14085    -1.97   0.049    -.5533868   -.0012363
                    8 75  |  -.5183904   .1506472    -3.44   0.001    -.8136688   -.2231119
                    8 77  |  -.3739331   .1471087    -2.54   0.011    -.6622759   -.0855904
                    8 78  |  -.2894394   .1401333    -2.07   0.039      -.56411   -.0147688
                    8 80  |  -.4728497   .1578936    -2.99   0.003    -.7823315   -.1633678
                    8 82  |  -.1971513   .1525991    -1.29   0.196    -.4962555    .1019529
                    8 83  |  -.3500584   .1451575    -2.41   0.016    -.6345767   -.0655401
                    8 85  |  -.2560926   .1496892    -1.71   0.087    -.5494932    .0373081
                    8 87  |  -.4159189   .1499648    -2.77   0.006    -.7098597   -.1219781
                    8 88  |  -.3064932   .1459851    -2.10   0.036    -.5926336   -.0203527
                    9 69  |   .3299893   .1803608     1.83   0.067    -.0235298    .6835084
                    9 70  |  -.0231599   .1347942    -0.17   0.864    -.2873655    .2410456
                    9 71  |  -.0250784   .1307968    -0.19   0.848    -.2814487    .2312918
                    9 72  |   .2005993   .1371623     1.46   0.144    -.0682478    .4694464
                    9 73  |  -.0341334    .127172    -0.27   0.788    -.2833988    .2151321
                    9 75  |  -.0829135   .1375615    -0.60   0.547    -.3525432    .1867161
                    9 77  |   .0777244   .1335767     0.58   0.561    -.1840947    .3395436
                    9 78  |   .1047841   .1258463     0.83   0.405    -.1418828    .3514511
                    9 80  |   .0437378   .1469431     0.30   0.766    -.2442802    .3317559
                    9 82  |   .1960192   .1403707     1.40   0.163    -.0791165     .471155
                    9 83  |   .0601735   .1326144     0.45   0.650    -.1997595    .3201064
                    9 85  |   .1240884   .1400423     0.89   0.376    -.1504037    .3985805
                    9 87  |   .0025405   .1407488     0.02   0.986    -.2733365    .2784175
                    9 88  |   .1095095   .1362618     0.80   0.422    -.1575727    .3765917
                   10 69  |   .1427868   .2281934     0.63   0.532    -.3044872    .5900608
                   10 70  |  -.0632808   .1860545    -0.34   0.734    -.4279599    .3013983
                   10 71  |   -.047924   .1898909    -0.25   0.801    -.4201227    .3242746
                   10 72  |   .1357275   .1837038     0.74   0.460    -.2243441     .495799
                   10 73  |  -.1803816   .1714186    -1.05   0.293    -.5163734    .1556102
                   10 75  |  -.1628151   .1798517    -0.91   0.365    -.5153364    .1897061
                   10 77  |  -.0864493   .1718997    -0.50   0.615    -.4233841    .2504854
                   10 78  |   .0294061   .1676043     0.18   0.861    -.2991095    .3579216
                   10 80  |  -.2301376   .1813364    -1.27   0.204    -.5855688    .1252936
                   10 82  |  -.0061144   .1751445    -0.03   0.972    -.3494092    .3371805
                   10 83  |   .0494868   .1717356     0.29   0.773    -.2871263    .3860998
                   10 85  |   .0651157   .1860532     0.35   0.726    -.2995609    .4297923
                   10 87  |  -.2468872   .1820171    -1.36   0.175    -.6036527    .1098782
                   10 88  |  -.0172385   .1749455    -0.10   0.922    -.3601433    .3256662
                   11 69  |   .2954905    .176374     1.68   0.094    -.0502141    .6411952
                   11 70  |  -.0592597   .1314488    -0.45   0.652     -.316908    .1983885
                   11 71  |   -.087225   .1276219    -0.68   0.494    -.3373724    .1629223
                   11 72  |   .1309269   .1335771     0.98   0.327     -.130893    .3927468
                   11 73  |  -.0868455   .1234816    -0.70   0.482    -.3288776    .1551865
                   11 75  |  -.2633748   .1328871    -1.98   0.047    -.5238423   -.0029073
                   11 77  |  -.1605356   .1292177    -1.24   0.214    -.4138107    .0927396
                   11 78  |  -.1387058   .1205775    -1.15   0.250    -.3750457    .0976341
                   11 80  |  -.2500322   .1415599    -1.77   0.077     -.527499    .0274346
                   11 82  |  -.0361886   .1358601    -0.27   0.790    -.3024833    .2301061
                   11 83  |  -.1245243   .1272809    -0.98   0.328    -.3740033    .1249548
                   11 85  |  -.1218121   .1344516    -0.91   0.365    -.3853461    .1417218
                   11 87  |  -.1645557   .1346131    -1.22   0.222    -.4284062    .0992948
                   11 88  |  -.0867714   .1304274    -0.67   0.506    -.3424177    .1688749
                   12 69  |   .3307019   .1823174     1.81   0.070    -.0266522     .688056
                   12 70  |   -.010282   .1386124    -0.07   0.941    -.2819715    .2614074
                   12 71  |   -.044383   .1344456    -0.33   0.741    -.3079052    .2191392
                   12 72  |   .2017759   .1396484     1.44   0.149    -.0719442    .4754961
                   12 73  |  -.0287431   .1306474    -0.22   0.826    -.2848205    .2273344
                   12 75  |  -.2233631   .1387102    -1.61   0.107    -.4952443    .0485181
                   12 77  |   -.079215   .1352447    -0.59   0.558    -.3443035    .1858735
                   12 78  |  -.1138058   .1276443    -0.89   0.373     -.363997    .1363854
                   12 80  |  -.1517652   .1473248    -1.03   0.303    -.4405315    .1370012
                   12 82  |   .0401467   .1415688     0.28   0.777    -.2373374    .3176308
                   12 83  |   .0032639   .1336612     0.02   0.981    -.2587208    .2652486
                   12 85  |  -.0144426   .1400393    -0.10   0.918    -.2889288    .2600437
                   12 87  |  -.0668112   .1401405    -0.48   0.634    -.3414958    .2078734
                   12 88  |   .0425139   .1361683     0.31   0.755    -.2243849    .3094127
                          |
                    _cons |   .2857499   .2202572     1.30   0.195    -.1459688    .7174685
            --------------+----------------------------------------------------------------
                  sigma_u |  .38100717
                  sigma_e |  .29051082
                      rho |  .63236002   (fraction of variance due to u_i)
            -------------------------------------------------------------------------------
            F test that all u_i=0: F(4693, 23295) = 7.64                 Prob > F = 0.0000
            
            . testparm(ind_code#year)
            
             ( 1)  2.ind_code#69.year = 0
             ( 2)  2.ind_code#71.year = 0
             ( 3)  2.ind_code#72.year = 0
             ( 4)  2.ind_code#73.year = 0
             ( 5)  2.ind_code#75.year = 0
             ( 6)  2.ind_code#77.year = 0
             ( 7)  2.ind_code#78.year = 0
             ( 8)  2.ind_code#80.year = 0
             ( 9)  2.ind_code#82.year = 0
             (10)  2.ind_code#83.year = 0
             (11)  2.ind_code#85.year = 0
             (12)  2.ind_code#87.year = 0
             (13)  2.ind_code#88.year = 0
             (14)  3.ind_code#69.year = 0
             (15)  3.ind_code#70.year = 0
             (16)  3.ind_code#71.year = 0
             (17)  3.ind_code#72.year = 0
             (18)  3.ind_code#73.year = 0
             (19)  3.ind_code#75.year = 0
             (20)  3.ind_code#77.year = 0
             (21)  3.ind_code#78.year = 0
             (22)  3.ind_code#80.year = 0
             (23)  3.ind_code#82.year = 0
             (24)  3.ind_code#83.year = 0
             (25)  3.ind_code#85.year = 0
             (26)  3.ind_code#87.year = 0
             (27)  3.ind_code#88.year = 0
             (28)  4.ind_code#69.year = 0
             (29)  4.ind_code#70.year = 0
             (30)  4.ind_code#71.year = 0
             (31)  4.ind_code#72.year = 0
             (32)  4.ind_code#73.year = 0
             (33)  4.ind_code#75.year = 0
             (34)  4.ind_code#77.year = 0
             (35)  4.ind_code#78.year = 0
             (36)  4.ind_code#80.year = 0
             (37)  4.ind_code#82.year = 0
             (38)  4.ind_code#83.year = 0
             (39)  4.ind_code#85.year = 0
             (40)  4.ind_code#87.year = 0
             (41)  4.ind_code#88.year = 0
             (42)  5.ind_code#69.year = 0
             (43)  5.ind_code#70.year = 0
             (44)  5.ind_code#71.year = 0
             (45)  5.ind_code#72.year = 0
             (46)  5.ind_code#73.year = 0
             (47)  5.ind_code#75.year = 0
             (48)  5.ind_code#77.year = 0
             (49)  5.ind_code#78.year = 0
             (50)  5.ind_code#80.year = 0
             (51)  5.ind_code#82.year = 0
             (52)  5.ind_code#83.year = 0
             (53)  5.ind_code#85.year = 0
             (54)  5.ind_code#87.year = 0
             (55)  5.ind_code#88.year = 0
             (56)  6.ind_code#69.year = 0
             (57)  6.ind_code#70.year = 0
             (58)  6.ind_code#71.year = 0
             (59)  6.ind_code#72.year = 0
             (60)  6.ind_code#73.year = 0
             (61)  6.ind_code#75.year = 0
             (62)  6.ind_code#77.year = 0
             (63)  6.ind_code#78.year = 0
             (64)  6.ind_code#80.year = 0
             (65)  6.ind_code#82.year = 0
             (66)  6.ind_code#83.year = 0
             (67)  6.ind_code#85.year = 0
             (68)  6.ind_code#87.year = 0
             (69)  6.ind_code#88.year = 0
             (70)  7.ind_code#69.year = 0
             (71)  7.ind_code#70.year = 0
             (72)  7.ind_code#71.year = 0
             (73)  7.ind_code#72.year = 0
             (74)  7.ind_code#73.year = 0
             (75)  7.ind_code#75.year = 0
             (76)  7.ind_code#77.year = 0
             (77)  7.ind_code#78.year = 0
             (78)  7.ind_code#80.year = 0
             (79)  7.ind_code#82.year = 0
             (80)  7.ind_code#83.year = 0
             (81)  7.ind_code#85.year = 0
             (82)  7.ind_code#87.year = 0
             (83)  7.ind_code#88.year = 0
             (84)  8.ind_code#69.year = 0
             (85)  8.ind_code#70.year = 0
             (86)  8.ind_code#71.year = 0
             (87)  8.ind_code#72.year = 0
             (88)  8.ind_code#73.year = 0
             (89)  8.ind_code#75.year = 0
             (90)  8.ind_code#77.year = 0
             (91)  8.ind_code#78.year = 0
             (92)  8.ind_code#80.year = 0
             (93)  8.ind_code#82.year = 0
             (94)  8.ind_code#83.year = 0
             (95)  8.ind_code#85.year = 0
             (96)  8.ind_code#87.year = 0
             (97)  8.ind_code#88.year = 0
             (98)  9.ind_code#69.year = 0
             (99)  9.ind_code#70.year = 0
             (100)  9.ind_code#71.year = 0
             (101)  9.ind_code#72.year = 0
             (102)  9.ind_code#73.year = 0
             (103)  9.ind_code#75.year = 0
             (104)  9.ind_code#77.year = 0
             (105)  9.ind_code#78.year = 0
             (106)  9.ind_code#80.year = 0
             (107)  9.ind_code#82.year = 0
             (108)  9.ind_code#83.year = 0
             (109)  9.ind_code#85.year = 0
             (110)  9.ind_code#87.year = 0
             (111)  9.ind_code#88.year = 0
             (112)  10.ind_code#69.year = 0
             (113)  10.ind_code#70.year = 0
             (114)  10.ind_code#71.year = 0
             (115)  10.ind_code#72.year = 0
             (116)  10.ind_code#73.year = 0
             (117)  10.ind_code#75.year = 0
             (118)  10.ind_code#77.year = 0
             (119)  10.ind_code#78.year = 0
             (120)  10.ind_code#80.year = 0
             (121)  10.ind_code#82.year = 0
             (122)  10.ind_code#83.year = 0
             (123)  10.ind_code#85.year = 0
             (124)  10.ind_code#87.year = 0
             (125)  10.ind_code#88.year = 0
             (126)  11.ind_code#69.year = 0
             (127)  11.ind_code#70.year = 0
             (128)  11.ind_code#71.year = 0
             (129)  11.ind_code#72.year = 0
             (130)  11.ind_code#73.year = 0
             (131)  11.ind_code#75.year = 0
             (132)  11.ind_code#77.year = 0
             (133)  11.ind_code#78.year = 0
             (134)  11.ind_code#80.year = 0
             (135)  11.ind_code#82.year = 0
             (136)  11.ind_code#83.year = 0
             (137)  11.ind_code#85.year = 0
             (138)  11.ind_code#87.year = 0
             (139)  11.ind_code#88.year = 0
             (140)  12.ind_code#69.year = 0
             (141)  12.ind_code#70.year = 0
             (142)  12.ind_code#71.year = 0
             (143)  12.ind_code#72.year = 0
             (144)  12.ind_code#73.year = 0
             (145)  12.ind_code#75.year = 0
             (146)  12.ind_code#77.year = 0
             (147)  12.ind_code#78.year = 0
             (148)  12.ind_code#80.year = 0
             (149)  12.ind_code#82.year = 0
             (150)  12.ind_code#83.year = 0
             (151)  12.ind_code#85.year = 0
             (152)  12.ind_code#87.year = 0
             (153)  12.ind_code#88.year = 0
            
                   F(153, 23295) =    2.47
                        Prob > F =    0.0000
            
            . testparm(i.ind_code)
            
             ( 1)  2.ind_code = 0
             ( 2)  3.ind_code = 0
             ( 3)  4.ind_code = 0
             ( 4)  5.ind_code = 0
             ( 5)  6.ind_code = 0
             ( 6)  7.ind_code = 0
             ( 7)  8.ind_code = 0
             ( 8)  9.ind_code = 0
             ( 9)  10.ind_code = 0
             (10)  11.ind_code = 0
             (11)  12.ind_code = 0
            
                   F( 11, 23295) =   25.07
                        Prob > F =    0.0000
            
            . testparm(i.year)
            
             ( 1)  69.year = 0
             ( 2)  70.year = 0
             ( 3)  71.year = 0
             ( 4)  72.year = 0
             ( 5)  73.year = 0
             ( 6)  75.year = 0
             ( 7)  77.year = 0
             ( 8)  78.year = 0
             ( 9)  80.year = 0
             (10)  82.year = 0
             (11)  83.year = 0
             (12)  85.year = 0
             (13)  87.year = 0
             (14)  88.year = 0
            
                   F( 14, 23295) =    1.21
                        Prob > F =    0.2580
            In the above toy-example (assuming that the model is correctly specified, something that I did not check for), -i.industry. seems to be more informative than -i.years- in explaining within-panel variations in the regressand.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              please when is it appropriate. 'xtreg dep-var x1 x2 x3 x4, fe' or 'xtreg dep-var x1 x2 x3 x4 i.year, fe' when is it approriate for a fixed effect model to include i.year? i am working on a panel data of 45 countries over a year period of 20 years. please assist

              Comment


              • #8
                Asmau:
                welcome to this forum.
                Code:
                xtreg dep-var x1 x2 x3 x4 i.year, fe vce(cluster panelid)
                is the way to go for your setup.
                Kind regards,
                Carlo
                (Stata 19.0)

                Comment

                Working...
                X