Announcement

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

  • Firm and Period Fixed Effects

    I have a longitudinal dataset of individuals nested in 10 firms. I am regressing (xtreg) an individual-level characteristic on various individual level predictors, using individual as the grouping variable. I'd also like to include dummies to account for firm and year effects. It strikes me that I could include one set of dummies for firm and another for year, or I could create a single set of dummies for firm*year (e.g., FirmA-2001, FirmA-2002, FirmA-2003, FirmB-2001, FirmB-2002, etc.). What is not clear to me is how the interpretation of the estimates would differ under these two approaches.

    Hoping someone can provide some guidance.
    Thanks.

  • #2
    I first want to point out that, based on the notation you used in stating your problem, you are perhaps unaware of Stata's "factor variable" notation, that eliminates the need to create dummy variables. If so, see the output of help fvvarlist for more details, as well as the more detailed material in Chapter 11 on the Stata User's Guide.

    With that said, in general if you want to include an interaction dummy like "FirmA in 2001" (which would be identical to the product of individual dummies for FirmA and 2001), you should also be including the individual dummies for FirmA and 2001. Otherwise you're ruling out a priori the possibilities that the year effects are independent of the firm effects, and vice versa. Wouldn't you prefer, if possible, so be able to make statements like "the effect of the year on [individual characteristic] was independent of (or was dependent on) the individual's firm"? Really, the issue of interactions for dummy variables is no different than interactions for any other variable.

    So using Stata's factor variable notation the two alternatives you expressed would be models including among the independent variables
    Code:
    i.firm i.year
    and
    Code:
    i.firm#i.year
    while my suggestion is
    Code:
    i.firm##i.year
    Last edited by William Lisowski; 07 Oct 2015, 11:32.

    Comment


    • #3
      Bob:
      I second William's helpful insight and would add that things may differ if you use -fe- or -re- specification (a detail that is not reported in your post), because -fe- cancels out time-invariant variables:
      Code:
      . use "http://www.stata-press.com/data/r13/nlswork.dta", clear
      (National Longitudinal Survey.  Young Women 14-26 years of age in 1968)
      
      . xtreg ln_wage i.yea##i.race, fe allbasel
      note: 2.race omitted because of collinearity
      note: 3.race omitted because of collinearity
      
      Fixed-effects (within) regression               Number of obs      =     28534
      Group variable: idcode                          Number of groups   =      4711
      
      R-sq:  within  = 0.1094                         Obs per group: min =         1
             between = 0.0420                                        avg =       6.1
             overall = 0.0439                                        max =        15
      
                                                      F(42,23781)        =     69.56
      corr(u_i, Xb)  = -0.0699                        Prob > F           =    0.0000
      
      ------------------------------------------------------------------------------
           ln_wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
              year |
               68  |          0  (base)
               69  |   .0770373    .014778     5.21   0.000     .0480714    .1060031
               70  |   .0666541   .0137877     4.83   0.000     .0396292    .0936789
               71  |   .1121696   .0137247     8.17   0.000     .0852683    .1390709
               72  |    .118821   .0140417     8.46   0.000     .0912984    .1463435
               73  |   .1331448   .0136827     9.73   0.000     .1063258    .1599638
               75  |   .1254407   .0136183     9.21   0.000     .0987479    .1521335
               77  |   .1825516   .0136557    13.37   0.000     .1557856    .2093176
               78  |   .2165712   .0139386    15.54   0.000     .1892508    .2438917
               80  |   .2304686   .0141335    16.31   0.000     .2027661    .2581711
               82  |   .2516737   .0137848    18.26   0.000     .2246546    .2786927
               83  |   .2790521   .0139634    19.98   0.000     .2516831    .3064212
               85  |   .3351751   .0137973    24.29   0.000     .3081316    .3622186
               87  |   .3543588   .0136673    25.93   0.000     .3275701    .3811474
               88  |   .4230864   .0136295    31.04   0.000     .3963716    .4498012
                   |
              race |
            white  |          0  (base)
            black  |          0  (omitted)
            other  |          0  (omitted)
                   |
         year#race |
         68#white  |          0  (base)
         68#black  |          0  (base)
         68#other  |          0  (base)
         69#white  |          0  (base)
         69#black  |   .0369524    .028591     1.29   0.196    -.0190878    .0929925
         69#other  |   .1723561   .1335697     1.29   0.197     -.089449    .4341613
         70#white  |          0  (base)
         70#black  |   .0294008   .0269925     1.09   0.276    -.0235062    .0823078
         70#other  |      .0145   .1325885     0.11   0.913    -.2453819    .2743819
         71#white  |          0  (base)
         71#black  |    .050927   .0265687     1.92   0.055    -.0011493    .1030032
         71#other  |   .1310062   .1357516     0.97   0.335    -.1350756     .397088
         72#white  |          0  (base)
         72#black  |   .0646022   .0275709     2.34   0.019     .0105614    .1186429
         72#other  |   .1239196   .1387271     0.89   0.372    -.1479943    .3958336
         73#white  |          0  (base)
         73#black  |   .0699154   .0266143     2.63   0.009     .0177497    .1220812
         73#other  |   .0488875    .137499     0.36   0.722    -.2206193    .3183942
         75#white  |          0  (base)
         75#black  |   .1442596   .0261804     5.51   0.000     .0929443    .1955749
         75#other  |    .100443   .1254399     0.80   0.423    -.1454272    .3463133
         77#white  |          0  (base)
         77#black  |   .1372045   .0262186     5.23   0.000     .0858143    .1885947
         77#other  |   .1450303    .123663     1.17   0.241     -.097357    .3874176
         78#white  |          0  (base)
         78#black  |   .1468236   .0267648     5.49   0.000     .0943628    .1992843
         78#other  |   .0618562   .1273841     0.49   0.627    -.1878248    .3115372
         80#white  |          0  (base)
         80#black  |   .1265801   .0270099     4.69   0.000      .073639    .1795211
         80#other  |   .0555611   .1321605     0.42   0.674    -.2034819    .3146041
         82#white  |          0  (base)
         82#black  |   .1263715   .0266211     4.75   0.000     .0741926    .1785505
         82#other  |   .0207876   .1241005     0.17   0.867    -.2224573    .2640325
         83#white  |          0  (base)
         83#black  |   .1160774   .0269742     4.30   0.000     .0632062    .1689486
         83#other  |   .0272039    .125974     0.22   0.829    -.2197132    .2741211
         85#white  |          0  (base)
         85#black  |   .0970325   .0268944     3.61   0.000     .0443179    .1497472
         85#other  |   .0519716   .1266758     0.41   0.682    -.1963211    .3002643
         87#white  |          0  (base)
         87#black  |   .0891829   .0269447     3.31   0.001     .0363696    .1419963
         87#other  |   .0523172   .1254108     0.42   0.677     -.193496    .2981304
         88#white  |          0  (base)
         88#black  |   .0514973   .0269219     1.91   0.056    -.0012712    .1042659
         88#other  |  -.0454668   .1269136    -0.36   0.720    -.2942256     .203292
                   |
             _cons |   1.441443   .0092383   156.03   0.000     1.423335    1.459551
      -------------+----------------------------------------------------------------
           sigma_u |  .41598047
           sigma_e |  .30252368
               rho |  .65406539   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      F test that all u_i=0:     F(4710, 23781) =     8.70         Prob > F = 0.0000
      
      . xtreg ln_wage i.yea##i.race, re allbasel
      
      Random-effects GLS regression                   Number of obs      =     28534
      Group variable: idcode                          Number of groups   =      4711
      
      R-sq:  within  = 0.1092                         Obs per group: min =         1
             between = 0.0947                                        avg =       6.1
             overall = 0.0904                                        max =        15
      
                                                      Wald chi2(44)      =   3394.03
      corr(u_i, X)   = 0 (assumed)                    Prob > chi2        =    0.0000
      
      ------------------------------------------------------------------------------
           ln_wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
              year |
               68  |          0  (base)
               69  |    .079035   .0145298     5.44   0.000     .0505572    .1075128
               70  |   .0670047   .0135118     4.96   0.000      .040522    .0934873
               71  |   .1109216   .0134088     8.27   0.000     .0846408    .1372025
               72  |   .1193255   .0137055     8.71   0.000     .0924631    .1461878
               73  |    .135243    .013334    10.14   0.000     .1091088    .1613772
               75  |   .1260171   .0132597     9.50   0.000     .1000285    .1520057
               77  |   .1899368   .0132857    14.30   0.000     .1638972    .2159764
               78  |   .2278853   .0135654    16.80   0.000     .2012976     .254473
               80  |   .2406971   .0137636    17.49   0.000      .213721    .2676733
               82  |   .2581406   .0134041    19.26   0.000      .231869    .2844122
               83  |     .28792   .0135665    21.22   0.000     .2613302    .3145099
               85  |   .3457167   .0133856    25.83   0.000     .3194814    .3719521
               87  |   .3621531   .0132497    27.33   0.000     .3361842    .3881221
               88  |   .4290616   .0131671    32.59   0.000     .4032545    .4548687
                   |
              race |
            white  |          0  (base)
            black  |  -.1956089   .0235379    -8.31   0.000    -.2417424   -.1494755
            other  |  -.0260184   .1122429    -0.23   0.817    -.2460104    .1939736
                   |
         year#race |
         68#white  |          0  (base)
         68#black  |          0  (base)
         68#other  |          0  (base)
         69#white  |          0  (base)
         69#black  |   .0237189   .0280892     0.84   0.398     -.031335    .0787727
         69#other  |    .191005   .1315988     1.45   0.147    -.0669239    .4489338
         70#white  |          0  (base)
         70#black  |   .0152205   .0263952     0.58   0.564    -.0365131    .0669541
         70#other  |   .0399471   .1290989     0.31   0.757    -.2130821    .2929764
         71#white  |          0  (base)
         71#black  |   .0348447    .025893     1.35   0.178    -.0159046     .085594
         71#other  |   .2016216   .1319195     1.53   0.126    -.0569359    .4601792
         72#white  |          0  (base)
         72#black  |   .0490708   .0268628     1.83   0.068    -.0035793    .1017209
         72#other  |   .1402147   .1329035     1.06   0.291    -.1202713    .4007007
         73#white  |          0  (base)
         73#black  |   .0486448    .025891     1.88   0.060    -.0021007    .0993902
         73#other  |   .0810307   .1328649     0.61   0.542    -.1793797    .3414411
         75#white  |          0  (base)
         75#black  |   .1240287    .025429     4.88   0.000     .0741889    .1738686
         75#other  |   .1483527   .1210206     1.23   0.220    -.0888433    .3855486
         77#white  |          0  (base)
         77#black  |   .1088644   .0254328     4.28   0.000      .059017    .1587118
         77#other  |   .1945567   .1191359     1.63   0.102    -.0389455    .4280588
         78#white  |          0  (base)
         78#black  |   .1157913   .0259916     4.45   0.000     .0648487    .1667339
         78#other  |   .1125353   .1225346     0.92   0.358    -.1276282    .3526988
         80#white  |          0  (base)
         80#black  |   .0995713   .0262352     3.80   0.000     .0481513    .1509913
         80#other  |   .1083772   .1273831     0.85   0.395    -.1412891    .3580436
         82#white  |          0  (base)
         82#black  |   .1020749   .0258178     3.95   0.000     .0514729     .152677
         82#other  |   .0849712   .1198371     0.71   0.478    -.1499052    .3198476
         83#white  |          0  (base)
         83#black  |   .0919558   .0261464     3.52   0.000     .0407098    .1432018
         83#other  |   .1370795   .1212876     1.13   0.258    -.1006398    .3747988
         85#white  |          0  (base)
         85#black  |   .0740004   .0260576     2.84   0.005     .0229285    .1250724
         85#other  |   .1420938   .1221972     1.16   0.245    -.0974083     .381596
         87#white  |          0  (base)
         87#black  |   .0718918   .0260857     2.76   0.006     .0207647    .1230189
         87#other  |   .1435271   .1209883     1.19   0.236    -.0936057    .3806599
         88#white  |          0  (base)
         88#black  |   .0311204   .0259647     1.20   0.231    -.0197694    .0820103
         88#other  |   .0452119   .1211986     0.37   0.709     -.192333    .2827568
                   |
             _cons |   1.479397   .0120531   122.74   0.000     1.455774    1.503021
      -------------+----------------------------------------------------------------
           sigma_u |  .36208147
           sigma_e |  .30252368
               rho |  .58889988   (fraction of variance due to u_i)
      ------------------------------------------------------------------------------
      As an aside, your chances of getting (more) helpful replies are conditional on posting exactly what you typed and what Stata gave you back (as per FAQ). Thanks..
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        William: I appreciate the explanation. However, suppose I'm less interested in whether firm and year depend on each other and instead want to remove the influence of unobserved firm attributes (constant within year) from estimates associated with my other predictors. Wouldn't this be achieved by including a dummy for firm*year (omitting the "main effects")? I notice that when I include a firm-level attribute (e.g., profit or firm size) that is constant within year, the predictor drops out of the estimation when I group by a firm*year variable (i.e., id):

        Code:
        xtreg ws profit size, fe i(id)
        note: profit omitted because of collinearity
        note: size omitted because of collinearity
        
        Fixed-effects (within) regression               Number of obs     =      1,166
        Group variable: id                                   Number of groups  =        206
        
        R-sq:                                           Obs per group:
        within  =      .                                            min =          1
        between =      .                                         avg =        5.7
        overall =      .                                            max =         12
        
        F(0,960)          =       0.00
        corr(u_i, Xb)  =      .                                 Prob > F          =          .
        
        
        ws              Coef.            Std. Err.        t        P>t       [95% Conf. Interval]
        
        profit           0  (omitted)
        size            0  (omitted)
        _cons          2.440566     .0737189    33.11   0.000     2.295897    2.585235
        
        sigma_u   1.3310006
        sigma_e   2.5172614
        rho   .21849111   (fraction of variance due to u_i)
        
        F test that all u_i=0: F(205, 960) = 1.19                    Prob > F = 0.0519
        This suggests to me that a dummy that identifies firm and year is accounting for variance due to firm characteristics for a given year. However, when I include separate dummies for firm and year, the predictors do not drop out, indicating that these two separate dummies are not equivalent to a single firm*year dummy.

        Code:
        . xi:reg ws profit size i.firm i.year
        i.firm             _Ifirm_1-30              (_Ifirm_1 for firm==WAL omitted)
        i.year            _Iyear_2006-2012    (naturally coded; _Iyear_2006 omitted)
        
        Source        SS           df                                 MS      Number of obs   =     1,166
                                                                             F(37, 1128)     =      4.41
        Model   964.298957        37   26.062134           Prob > F        =    0.0000
        Residual   6660.65227     1,128  5.90483357     R-squared       =    0.1265
                                                                             Adj R-squared   =    0.0978
        Total   7624.95123     1,165  6.54502251           Root MSE        =      2.43
        
        
        ws                      Coef.   Std. Err.      t    P>t     [95% Conf. Interval]
        
        profit         .0434737   .0079726     5.45   0.000     .0278309    .0591166
        size         -.097757   .1664725    -0.59   0.557    -.4243875    .2288736
        _Ifirm_2   -.4143314   .5902837    -0.70   0.483    -1.572509    .7438461
        _Ifirm_3   -.5363976   .5825401    -0.92   0.357    -1.679382    .6065864
        ...
        Assume I had an additional X in the models above that varied within firmyear. I am confused about how the interpretation of the estimate would differ across models. My best guess: In Model 1, the X effect would be net of the influence of stable factors within firmyear, but not of those factors stable within firm and within year. On the other hand, effects estimated in Model 2 would be net of stable firm factors and stable year factors but not of stable firmyear factors.
        Last edited by Bob Hernandez; 08 Oct 2015, 08:17.

        Comment

        Working...
        X