Announcement

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

  • Panel fixed effects: How to avoid Dummy Variable Trap with time fixed effects

    Hi,

    I have a question about using time fixed effects in a panel data setting and avoiding dummy variable trap.

    I will explain my problem to make the question clearer:

    I want to determine what variables drive the speed that a fund manager invests through time. My dependent variable is a time series of "capital that a fund has invested" for every fund. This is at a quarterly frequency and from 2000 to 2017.

    Note however that each fund level data time series does not span the whole period. As the funds opened at different points in time (e.g. some were launched in 2000 others in 2001, 2002, etc) the data starts at different points in time.

    My concern is twofold: I want to include an explanatory variable which varies through time but is the same for all funds. For example the yearly return of the US stock market index (S&P500) as shown in the model below.

    CapInvestedit = ai + b USequityReturnt + g timeEffectst + ei t

    As the time fixed effects will be collinear with the US equity returns one of the time effects needs to be dropped when estimating the model with xtreg (see Stata output) (q. Does that mean that I can never use time fixed effects when using this type of explanatory variable (which does not vary across individual but only across time)? Is there any way around this?

    Code:
    . xtreg marg_called spx_yoy i.quarter , fe robust
    note: 176.quarter omitted because of collinearity
    
    Fixed-effects (within) regression               Number of obs      =     99076
    Group variable: fundid_fun~e                    Number of groups   =      3663
    
    R-sq:  within  = 0.0628                         Obs per group: min =         1
           between = 0.0654                                        avg =      27.0
           overall = 0.0149                                        max =        68
    
                                                    F(67,3662)         =     24.30
    corr(u_i, Xb)  = -0.2667                        Prob > F           =    0.0000
    
                         (Std. Err. adjusted for 3663 clusters in fundid_fundtype)
    ------------------------------------------------------------------------------
                 |               Robust
     marg_called |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
         spx_yoy |   .0021898   .0047615     0.46   0.646    -.0071457    .0115252
                 |
         quarter |
            165  |   .3634196   .2077487     1.75   0.080     -.043895    .7707343
            166  |   .0673388   .2092053     0.32   0.748    -.3428316    .4775092
            167  |  -.0017774   .2124482    -0.01   0.993    -.4183059    .4147511
            168  |  -.2032346   .1689662    -1.20   0.229    -.5345118    .1280426
            169  |  -.0529558   .1859052    -0.28   0.776    -.4174438    .3115321
            170  |  -.4048783   .2090664    -1.94   0.053    -.8147764    .0050198
            171  |   .0751246   .2536233     0.30   0.767    -.4221323    .5723815
            172  |  -.2271042   .2259984    -1.00   0.315    -.6701993    .2159909
            173  |  -.1562853   .1924783    -0.81   0.417    -.5336605    .2210899
            174  |  -.1072304   .1721214    -0.62   0.533    -.4446936    .2302329
            175  |  -.1459967   .1656886    -0.88   0.378    -.4708477    .1788544
            176  |          0  (omitted)
            177  |   .5829734   .2048757     2.85   0.004     .1812915    .9846552
            178  |   .2298571   .1871147     1.23   0.219    -.1370022    .5967164
            179  |   .2485688   .1906258     1.30   0.192    -.1251745    .6223121
            180  |   .3328267   .1797579     1.85   0.064    -.0196087    .6852622
            181  |   .0123119   .1684457     0.07   0.942    -.3179447    .3425685
            182  |   .0829718   .1741036     0.48   0.634    -.2583779    .4243215
            183  |   .3220636   .1859411     1.73   0.083    -.0424949     .686622
            184  |   .0987804   .1728828     0.57   0.568    -.2401757    .4377365
            185  |  -.0045399   .1704852    -0.03   0.979    -.3387952    .3297155
            186  |  -.1576511   .1608511    -0.98   0.327    -.4730176    .1577155
            187  |   .2527712   .1834247     1.38   0.168    -.1068535     .612396
            188  |  -.1552237   .1745983    -0.89   0.374    -.4975433    .1870959
            189  |  -.1698568   .1711432    -0.99   0.321    -.5054021    .1656886
            190  |  -.4140906    .173447    -2.39   0.017    -.7541529   -.0740284
            191  |   .0017222   .1907655     0.01   0.993     -.372295    .3757394
            192  |   -.801054   .1569176    -5.10   0.000    -1.108709   -.4933994
            193  |  -.8747737   .1609558    -5.43   0.000    -1.190346   -.5592018
            194  |  -.7400855   .1893973    -3.91   0.000     -1.11142   -.3687509
            195  |  -1.054512   .2637383    -4.00   0.000    -1.571601   -.5374239
            196  |  -1.379948   .2633164    -5.24   0.000    -1.896209   -.8636866
            197  |  -1.336222   .2448343    -5.46   0.000    -1.816247   -.8561972
            198  |  -1.460848    .185791    -7.86   0.000    -1.825112   -1.096583
            199  |  -1.386937   .1303834   -10.64   0.000    -1.642568   -1.131305
            200  |  -1.539267   .1863003    -8.26   0.000     -1.90453   -1.174004
            201  |  -1.267155   .1558174    -8.13   0.000    -1.572653    -.961658
            202  |  -1.355659   .1289233   -10.52   0.000    -1.608427    -1.10289
            203  |  -1.132549   .1315177    -8.61   0.000    -1.390405   -.8746941
            204  |  -1.508157   .1288626   -11.70   0.000    -1.760806   -1.255507
            205  |  -1.501627   .1281399   -11.72   0.000     -1.75286   -1.250395
            206  |  -1.429224   .1284764   -11.12   0.000    -1.681116   -1.177331
            207  |  -1.446775   .1311461   -11.03   0.000    -1.703901   -1.189648
            208  |  -1.566608   .1274366   -12.29   0.000    -1.816462   -1.316754
            209  |  -1.703131   .1240032   -13.73   0.000    -1.946253   -1.460009
            210  |  -1.760753   .1246472   -14.13   0.000    -2.005137   -1.516368
            211  |  -1.519571   .1308827   -11.61   0.000    -1.776182   -1.262961
            212  |  -1.910804   .1221832   -15.64   0.000    -2.150357    -1.67125
            213  |  -1.930304    .132662   -14.55   0.000    -2.190403   -1.670205
            214  |  -1.916775   .1334156   -14.37   0.000    -2.178351   -1.655199
            215  |   -1.92109   .1434959   -13.39   0.000     -2.20243   -1.639751
            216  |  -2.080455   .1322585   -15.73   0.000    -2.339762   -1.821147
            217  |  -2.005137   .1304181   -15.37   0.000    -2.260836   -1.749437
            218  |  -2.052398   .1303389   -15.75   0.000    -2.307942   -1.796854
            219  |  -2.019814   .1253039   -16.12   0.000    -2.265486   -1.774142
            220  |  -2.149828   .1213671   -17.71   0.000    -2.387782   -1.911875
            221  |  -2.116326   .1211521   -17.47   0.000    -2.353858   -1.878794
            222  |  -2.137921   .1286837   -16.61   0.000     -2.39022   -1.885622
            223  |  -2.177748   .1253641   -17.37   0.000    -2.423538   -1.931957
            224  |   -2.35278   .1387592   -16.96   0.000    -2.624833   -2.080727
            225  |  -2.347668   .1304164   -18.00   0.000    -2.603364   -2.091972
            226  |  -2.373192   .1225429   -19.37   0.000    -2.613451   -2.132933
            227  |  -2.389172    .120666   -19.80   0.000    -2.625751   -2.152593
            228  |  -2.611655   .1301455   -20.07   0.000     -2.86682    -2.35649
            229  |  -2.409805   .1264132   -19.06   0.000    -2.657652   -2.161958
            230  |  -2.401352     .12628   -19.02   0.000    -2.648938   -2.153766
            231  |  -2.476485   .1302434   -19.01   0.000    -2.731842   -2.221129
                 |
           _cons |   2.660913   .1150825    23.12   0.000      2.43528    2.886545
    -------------+----------------------------------------------------------------
         sigma_u |  2.6434856
         sigma_e |  2.7854585
             rho |  .47386677   (fraction of variance due to u_i)
    ------------------------------------------------------------------------------
    Secondly, how can I evaluate how many regressors I can use (degrees of freedom) in panel data settings before I risk overfitting the data? I am concerned that the inclusion of time fixed effects will increase the number of regressors so much that the regression results will not unreliable. See for example comment #10 in the thread below.

    https://www.statalist.org/forums/for...nexpected-sign

    Thanks

  • #2
    Roman:
    welcome to this forum.
    As far as -timevar- is concerned, it would possibly be more interesting to search for turning point, considering -quarter as continuos instead of categorical (by the way, a more parsimonius model):
    Code:
    xtreg marg_called spx_yoy c.quarter##.quarter , fe robust
    Besides, is there any reason why you clustered SEs (autocorrelation?). Using default SEs with -fe- should allow Stata to report an F-test as a footnote of the outcome table: if it reaches statistical significance, you can go -xtreg-, otherwise you would be better off with pooled OLS.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlo,

      Many thanks for your prompt reply.

      Just to make sure, I assume that you mean the following specification (there was a "c" missing in front of the second "quarter"). This gives me the following output (and I got rid of the clustering to show the F-test results):

      Code:
       
       . xtreg marg_called spx_yoy c.quarter##c.quarter , fe  Fixed-effects (within) regression               Number of obs      =     99076 Group variable: fundid_fun~e                    Number of groups   =      3663  R-sq:  within  = 0.0567                         Obs per group: min =         1        between = 0.0847                                        avg =      27.0        overall = 0.0108                                        max =        68                                                  F(3,95410)         =   1911.73 corr(u_i, Xb)  = -0.2775                        Prob > F           =    0.0000  -------------------------------------------------------------------------------------         marg_called |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval] --------------------+----------------------------------------------------------------             spx_yoy |   .0066692   .0006482    10.29   0.000     .0053988    .0079396             quarter |  -.0648124   .0126339    -5.13   0.000    -.0895747   -.0400502                     | c.quarter#c.quarter |   .0000405   .0000311     1.30   0.194    -.0000205    .0001015                     |               _cons |   12.80593   1.275634    10.04   0.000      10.3057    15.30616 --------------------+----------------------------------------------------------------             sigma_u |  2.6565279             sigma_e |  2.7935595                 rho |  .47487287   (fraction of variance due to u_i) ------------------------------------------------------------------------------------- F test that all u_i=0:     F(3662, 95410) =     8.72         Prob > F = 0.0000
      I am not sure that I follow why I should use this specification. Doesn't this just add a time trend and a squared term time?

      I just want to control for time-specific events which are not captured by my other explanatory variables. That is why add separate time fixed effects.

      By the way, I cluster the errors because of autocorrelation and other fund specific characteristics I want to control for.

      Kind regards,
      Roman

      Comment


      • #4
        Roman:
        1) my mistake: I omitted the c. you correctly mentioned.
        2) I see why you clustered your standard errors, and it seems reasonable;
        3) categorical or continuous -timevar-: the reason behind my previous proposal was that, while it's perfectly legal to add -i.time- among predictors, with so many quarters I would find hard to disseminate my results.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Hi Carlo,

          Many thanks for your answer.

          Sorry, I don't quite follow what you mean for 3) when you write "I would find hard to disseminate my results"?

          Do you mean that you would be worried about overfitting (i.e. too many regressors)?

          Best,
          Roman

          Comment


          • #6
            Roman:
            I meant that I would found difficult to comment on so many quarters (I did not mean overfitting, which seems one of your main worries, which seems unjustified with such a low Rsq-within. I would be more concerned about a too scant handful of predictors).
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Ok, thanks for taking the time to answer my questions Carlo,

              Best,
              Roman

              Comment

              Working...
              X