Announcement

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

  • Panel Data - Fixed Effects

    Hello everyone,

    I have a question regarding the xtreg function in Stata 18.0. I am working with daily stock return data on 74 different event days with approx. 2000 different firms. I am investigating the impact of monetary policy surprises on stock returns. Below is an excerpt of my dataset (I have excluded the control variables in my dataset for clarity).

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float date long permno double ret float surprise
    20479 10026 -.009236           0
    20529 10026  .019201 -.000103333
    20571 10026   .00534           0
    20620 10026 -.000922           0
    20662 10026 -.001725           0
    20718 10026  .008948 -.000416667
    20760 10026  -.01691 -.000053571
    20802 10026 -.017747           0
    20851 10026 -.011758 -.000025926
    20893 10026  .010285  .000048437
    20942 10026  .000076           0
    20984 10026   .00359   .00009375
    21026 10026   -.0027           0
    21082 10026 -.001948           0
    21124 10026 -.006683           0
    21166 10026  .008343  .000043056
    21215 10026 -.003957           0
    21264 10026 -.013563    .0000775
    21306 10026 -.018248           0
    21348 10026  .007196 -.000044118
    21397 10026   -.0258 -.000025833
    21453 10026  .005694           0
    21496 10026 -.003185  .000034091
    21537 10026  .022914  .000322917
    21579 10026 -.040301           0
    21628 10026  .007546  .000140909
    21670 10026  .008716 -.000206897
    21719 10026  .015992  .000409091
    21761 10026  .003889           0
    21810 10026 -.001969   -.0003125
    21852 10026 -.004247    -.000025
    21894 10026  .004186           0
    21943 10026  .020908     .000025
    21977 10026  .001342 -.002989286
    21997 10026 -.124233 -.000484375
    22034 10026  .084751     -.00005
    22076 10026 -.016078   -.0000375
    22125 10026 -.010398           0
    22154 10026  .025357  -.00019375
    22174 10026 -.000883           0
    22224 10026  .009185           0
    22265 10026  .002083 -.000051667
    22307 10026 -.040204           0
    22356 10026 -.001581 -.000055357
    22398 10026 -.011462    -.000025
    22447 10026 -.009215  .000267857
    22489 10026 -.001861           0
    22545 10026  .005718           0
    22587 10026  .016989  .000055556
    22629 10026  .022852 -.000048437
    22671 10026  .001653    -.000155
    22720 10026  .013339 -.000258333
    22769 10026 -.015536 -.000143519
    22811 10026  .017982      .00035
    22853 10026  .003448   -.0003875
    22909 10026  .004593 -.000416667
    22951 10026 -.009013 -.000026786
    22993 10026 -.006874           0
    23042 10026 -.030775 -.000077778
    23091 10026  -.00841  .000430556
    23133 10026 -.012013  .000276786
    23175 10026 -.012561   -.0001875
    23217 10026 -.007289           0
    23273 10026 -.012247     -.00015
    23315 10026  .014367           0
    23357 10026  .008502 -.000043056
    20851 10032 -.004972 -.000025926
    20893 10032  .017902  .000048437
    20942 10032 -.014436           0
    20984 10032 -.015266   .00009375
    21026 10032 -.004191           0
    21082 10032  .000553           0
    21124 10032 -.012535           0
    21166 10032 -.000816  .000043056
    21215 10032 -.003336           0
    21264 10032 -.001859    .0000775
    21306 10032  .007824           0
    21348 10032 -.007869 -.000044118
    21397 10032  .007405 -.000025833
    21453 10032  -.01294           0
    21496 10032 -.011944  .000034091
    21537 10032 -.008086  .000322917
    21579 10032  .011482           0
    21628 10032  .007685  .000140909
    21670 10032  .004819 -.000206897
    21719 10032  .004823  .000409091
    21761 10032  .005727           0
    21810 10032 -.005339   -.0003125
    21852 10032  .012768    -.000025
    21894 10032  .007673           0
    21943 10032 -.018587     .000025
    21977 10032  -.02458 -.002989286
    21997 10032  .064651 -.000484375
    22034 10032   .04923     -.00005
    22076 10032 -.038828   -.0000375
    22125 10032  .030476           0
    22154 10032 -.019716  -.00019375
    22174 10032  .003912           0
    22224 10032  .035623           0
    22265 10032 -.009124 -.000051667
    end
    format %td date
    I want to run regressions using the xtreg command, and I want to control for both firm fixed effects (variable permno is my firm identifier) and time fixed effects. I have read conflicting things online on how to do this.

    What I have currently done is the following:

    Code:
     xtset permno date
    xtreg ret surprise esgrating esg_int_exp esg_int_sur esg_int_tim timing neg_sup_int no_change_int dt_int mkval_int bm_int roe_int ppe_int mom_int inv_int sales_int ln_mkvalt dt roe bm ln_ppe invst sgrth momntm, fe
    which has produced the following coefficients:

    Code:
    Fixed-effects (within) regression               Number of obs     =     88,319
    Group variable: permno                          Number of groups  =      2,038
    
    R-squared:                                      Obs per group:
         Within  = 0.0267                                         min =          6
         Between = 0.0118                                         avg =       43.3
         Overall = 0.0083                                         max =         74
    
                                                    F(25, 86256)      =      94.77
    corr(u_i, Xb) = -0.5813                         Prob > F          =     0.0000
    
    -------------------------------------------------------------------------------
              ret | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    --------------+----------------------------------------------------------------
      OneExpected |   .0918092   .1372663     0.67   0.504    -.1772315    .3608498
      surprise |  -48.44583   2.379399   -20.36   0.000    -53.10943   -43.78223
        esgrating |   .0000183   .0000179     1.02   0.307    -.0000168    .0000534
      esg_int_exp |    -.00003   .0029041    -0.01   0.992     -.005722    .0056621
      esg_int_sur |   .0186444   .0252429     0.74   0.460    -.0308315    .0681202
      esg_int_tim |   .0018503   .0262529     0.07   0.944    -.0496052    .0533057
           timing |  -16.05397   1.215398   -13.21   0.000    -18.43614    -13.6718
      neg_sup_int |   52.33743   1.533614    34.13   0.000     49.33156     55.3433
    no_change_int |   10.83651   1.245357     8.70   0.000      8.39562     13.2774
           dt_int |   .0000201   .0000231     0.87   0.384    -.0000252    .0000653
        mkval_int |  -.3424101   .3010847    -1.14   0.255    -.9325334    .2477133
           bm_int |   .8276909   .5578829     1.48   0.138    -.2657549    1.921137
          roe_int |   .1996184   .2649274     0.75   0.451     -.319637    .7188738
          ppe_int |   .1877326   .2325846     0.81   0.420    -.2681312    .6435963
          mom_int |   4.860716    1.66968     2.91   0.004     1.588158    8.133273
          inv_int |  -22.73963   6.750481    -3.37   0.001    -35.97051    -9.50874
        sales_int |   .0595276   .0226595     2.63   0.009     .0151153      .10394
        ln_mkvalt |  -.0007899   .0003347    -2.36   0.018    -.0014459   -.0001338
               dt |  -7.26e-08   4.14e-08    -1.75   0.080    -1.54e-07    8.56e-09
              roe |  -.0001611   .0000962    -1.67   0.094    -.0003497    .0000274
               bm |   .0023624   .0003866     6.11   0.000     .0016045    .0031202
           ln_ppe |   .0032718   .0003096    10.57   0.000     .0026649    .0038787
            invst |   .0008607   .0022009     0.39   0.696    -.0034531    .0051746
            sgrth |  -7.88e-06   6.59e-06    -1.20   0.231    -.0000208    5.03e-06
           momntm |   .0047439   .0007104     6.68   0.000     .0033514    .0061363
            _cons |  -.0091379   .0025128    -3.64   0.000     -.014063   -.0042128
    --------------+----------------------------------------------------------------
          sigma_u |  .01127148
          sigma_e |  .03717523
              rho |  .08418993   (fraction of variance due to u_i)
    -------------------------------------------------------------------------------
    F test that all u_i=0: F(2037, 86256) = 1.20                 Prob > F = 0.0000
    My question is, am I currently controlling for firm fixed-effects and time fixed-effects in my model? I am worried that I have not adequately done so because my Adjusted R-squared is quite low.

    I have seen other posts which say I need to include i.date in my regression command in order to control for time fixed-effects:

    Code:
     xtset permno date
    xtreg ret surprise esgrating esg_int_exp esg_int_sur esg_int_tim timing neg_sup_int no_change_int dt_int mkval_int bm_int roe_int ppe_int mom_int inv_int sales_int ln_mkvalt dt roe bm ln_ppe invst sgrth momntm i.date, fe
    However, when I do this my coefficients completely change and the magnitude and signs become non-sensical. However, the Adjusted R-squared increases significantly:

    Code:
     note: 23042.date omitted because of collinearity.
    note: 23133.date omitted because of collinearity.
    note: 23217.date omitted because of collinearity.
    note: 23315.date omitted because of collinearity.
    note: 23357.date omitted because of collinearity.
    
    Fixed-effects (within) regression               Number of obs     =     88,319
    Group variable: permno                          Number of groups  =      2,038
    
    R-squared:                                      Obs per group:
         Within  = 0.1921                                         min =          6
         Between = 0.0039                                         avg =       43.3
         Overall = 0.1835                                         max =         74
    
                                                    F(93, 86188)      =     220.37
    corr(u_i, Xb) = -0.0603                         Prob > F          =     0.0000
    
    -------------------------------------------------------------------------------
              ret | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    --------------+----------------------------------------------------------------
      OneExpected |   6.796714   .7918931     8.58   0.000      5.24461    8.348818
      surprise |   26.21209   7.478254     3.51   0.000     11.55478     40.8694
        esgrating |  -.0000106   .0000188    -0.56   0.574    -.0000475    .0000263
      esg_int_exp |  -.0000325   .0026592    -0.01   0.990    -.0052445    .0051795
      esg_int_sur |   .0162498   .0230465     0.71   0.481    -.0289212    .0614207
      esg_int_tim |  -.0051134   .0240422    -0.21   0.832    -.0522359    .0420091
           timing |  -32.96346   6.601368    -4.99   0.000    -45.90208   -20.02483
      neg_sup_int |  -160.2517   19.30401    -8.30   0.000    -198.0874    -122.416
    no_change_int |  -610.9967   40.19729   -15.20   0.000     -689.783   -532.2103
           dt_int |   .0000101    .000021     0.48   0.631    -.0000311    .0000514
        mkval_int |  -.2354808   .2751035    -0.86   0.392    -.7746812    .3037197
           bm_int |   .8244886   .5089378     1.62   0.105    -.1730253    1.822002
          roe_int |   .2731069   .2415257     1.13   0.258    -.2002814    .7464953
          ppe_int |   .2344717   .2123137     1.10   0.269    -.1816613    .6506047
          mom_int |   11.61357   1.564232     7.42   0.000     8.547694    14.67946
          inv_int |  -18.84024   6.161159    -3.06   0.002    -30.91605   -6.764417
        sales_int |   .0186329   .0207489     0.90   0.369    -.0220348    .0593005
        ln_mkvalt |  -.0012695   .0003136    -4.05   0.000    -.0018842   -.0006548
               dt |  -7.39e-08   3.86e-08    -1.92   0.055    -1.50e-07    1.73e-09
              roe |  -.0001227   .0000877    -1.40   0.162    -.0002946    .0000493
               bm |   .0016245   .0003619     4.49   0.000     .0009152    .0023338
           ln_ppe |   .0013063   .0003112     4.20   0.000     .0006964    .0019162
            invst |   .0008918   .0020088     0.44   0.657    -.0030454    .0048289
            sgrth |  -8.81e-06   6.00e-06    -1.47   0.143    -.0000206    2.96e-06
           momntm |   .0031732   .0007069     4.49   0.000     .0017877    .0045586
                  |
             date |
           20165  |  -.0241139    .002963    -8.14   0.000    -.0299214   -.0183063
           20207  |   .0085938    .002341     3.67   0.000     .0040055    .0131821
           20256  |   .0092998   .0018791     4.95   0.000     .0056168    .0129828
           20298  |   .0250062   .0023411    10.68   0.000     .0204177    .0295948
           20348  |  -.4246875   .0223288   -19.02   0.000    -.4684517   -.3809232
           20389  |   .0436464    .004134    10.56   0.000     .0355439    .0517489
           20438  |   .0047311   .0022689     2.09   0.037      .000284    .0091782
           20479  |   .0354517   .0021148    16.76   0.000     .0313067    .0395967
           20529  |  -.0688918   .0030535   -22.56   0.000    -.0748766   -.0629069
           20571  |   .0170298   .0019094     8.92   0.000     .0132873    .0207723
           20620  |    .008701   .0015669     5.55   0.000     .0056298    .0117722
           20662  |    .009031   .0019097     4.73   0.000      .005288    .0127739
           20718  |  -.2744367   .0184158   -14.90   0.000    -.3105315   -.2383419
           20760  |  -.0346885    .003632    -9.55   0.000    -.0418072   -.0275699
           20802  |  -.0120867   .0017295    -6.99   0.000    -.0154765    -.008697
           20851  |  -.0061986   .0026273    -2.36   0.018    -.0113481    -.001049
           20893  |   .0055347   .0019237     2.88   0.004     .0017643    .0093052
           20942  |   .0100317   .0025066     4.00   0.000     .0051189    .0149446
           20984  |  -.0151237   .0020422    -7.41   0.000    -.0191265    -.011121
           21026  |   .0060944   .0015896     3.83   0.000     .0029789      .00921
           21082  |   .0208798   .0027847     7.50   0.000     .0154219    .0263377
           21124  |   .0082375   .0019948     4.13   0.000     .0043277    .0121473
           21166  |  -.0033182   .0016841    -1.97   0.049    -.0066191   -.0000173
           21215  |   .0067527   .0021991     3.07   0.002     .0024426    .0110629
           21264  |  -.0045003   .0018294    -2.46   0.014     -.008086   -.0009147
           21306  |   .0165483   .0021986     7.53   0.000     .0122391    .0208576
           21348  |  -.0142373   .0012278   -11.60   0.000    -.0166438   -.0118307
           21397  |  -.0113663   .0023061    -4.93   0.000    -.0158862   -.0068464
           21453  |  -.0106654   .0013811    -7.72   0.000    -.0133723   -.0079585
           21496  |   .0298993   .0020608    14.51   0.000     .0258601    .0339385
           21537  |   -.029314   .0027123   -10.81   0.000    -.0346302   -.0239978
           21579  |   .0252536   .0019295    13.09   0.000     .0214719    .0290353
           21628  |   .0860077   .0063951    13.45   0.000     .0734733     .098542
           21670  |   -.144607    .010056   -14.38   0.000    -.1643168   -.1248972
           21719  |   .2149152    .023774     9.04   0.000     .1683185     .261512
           21761  |   .0426159   .0075379     5.65   0.000     .0278417    .0573901
           21810  |  -.0074174    .008726    -0.85   0.395    -.0245203    .0096854
           21852  |   .0229671   .0036426     6.31   0.000     .0158277    .0301066
           21894  |   .0152268   .0019253     7.91   0.000     .0114532    .0190003
           21943  |   .0235284   .0021088    11.16   0.000     .0193952    .0276617
           21977  |  -.3990293   .0507958    -7.86   0.000    -.4985887   -.2994699
           21997  |   -.354512   .0205672   -17.24   0.000    -.3948235   -.3142004
           22034  |    .023062   .0020335    11.34   0.000     .0190762    .0270477
           22076  |  -.0433423    .002382   -18.20   0.000    -.0480109   -.0386736
           22125  |   .0346309   .0019186    18.05   0.000     .0308706    .0383913
           22154  |  -.1262131   .0092404   -13.66   0.000    -.1443242    -.108102
           22174  |   .0213518   .0019171    11.14   0.000     .0175943    .0251093
           22224  |   .0381453   .0019173    19.90   0.000     .0343874    .0419033
           22265  |  -.0286708   .0034687    -8.27   0.000    -.0354694   -.0218722
           22307  |  -.0080296   .0019211    -4.18   0.000     -.011795   -.0042642
           22356  |  -.0205193   .0036134    -5.68   0.000    -.0276015   -.0134371
           22398  |  -.0066356   .0019839    -3.34   0.001    -.0105239   -.0027472
           22447  |    .160249   .0120706    13.28   0.000     .1365907    .1839072
           22489  |   .0244422   .0019184    12.74   0.000     .0206821    .0282023
           22545  |   .0262551   .0019185    13.69   0.000      .022495    .0300153
           22587  |   .0589304    .002599    22.67   0.000     .0538363    .0640245
           22629  |  -.0051842   .0039699    -1.31   0.192    -.0129651    .0025968
           22671  |  -.1092571   .0082025   -13.32   0.000    -.1253339   -.0931802
           22720  |   .0097277   .0050864     1.91   0.056    -.0002417     .019697
           22769  |  -.0334608   .0053344    -6.27   0.000    -.0439163   -.0230054
           22811  |  -.0507068   .0098841    -5.13   0.000    -.0700796    -.031334
           22853  |  -.0657505   .0055766   -11.79   0.000    -.0766805   -.0548205
           22909  |    -.09439   .0057388   -16.45   0.000    -.1056381   -.0831419
           22951  |    -.08044   .0051612   -15.59   0.000    -.0905558   -.0703242
           22993  |  -.0282671   .0030825    -9.17   0.000    -.0343087   -.0222255
           23042  |          0  (omitted)
           23091  |  -.0601794    .006925    -8.69   0.000    -.0737524   -.0466064
           23133  |          0  (omitted)
           23175  |  -.1382605   .0084646   -16.33   0.000    -.1548511   -.1216699
           23217  |          0  (omitted)
           23273  |  -.1053673   .0074523   -14.14   0.000    -.1199738   -.0907608
           23315  |          0  (omitted)
           23357  |          0  (omitted)
                  |
            _cons |  -.0097427   .0030525    -3.19   0.001    -.0157255   -.0037598
    --------------+----------------------------------------------------------------
          sigma_u |  .00846049
          sigma_e |  .03388323
              rho |  .05868871   (fraction of variance due to u_i)
    -------------------------------------------------------------------------------
    F test that all u_i=0: F(2037, 86188) = 1.28                 Prob > F = 0.0000
    Could someone please let me know if what I currently have is correct, or if I am making any error in my code. I am relatively new to Stata and this is my first post on Statalist so apologies if what I have said isn't clear. I would greatly appreciate any assistance.

    Thanks in advance!

  • #2
    Daniel:
    welcome to this forum.
    1) I'm under the impression that you should consider a more parsimonius model, just to start off.
    2) you actually have tons of predictors. I would find difficult making any sense out of them even if their coefficients where all significant (which is not, by the way, the most important goal of a regression). Therefore, you should focus your attention on those predictors that give a fair and true view of the data generating process;
    3) with such an impressive sample (and 2038 panels) you should use the cluster-robust standard errors (see -robust- or -vce(cluster panelid) options; the do the very same job under -xtreg-);
    4) while Adj-Rsq is useful to compare different regression specifications, you should also consider the within Rsq when you go -xtreg,fe- (the higher, the better).
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlo,

      Wow! Thanks for the quick response.

      Regarding your first two points, this model is actually a close replication of a model from a paper which is similar to my own, it seems quite exhaustive because there are control variables interacting with the monetary policy surprise predictor variable as well as the un-interactive control variables.

      Thank you for your recommendation in point (3), including the -robust- option led to an improvement in my within Rsq.

      Just so I'm sure I've understood you correctly, is it necessary to include an -i.date- term in my -xtreg- command in order to control for time fixed-effects? Or is that already taken care of when declaring panel data using -xtset permno date- and -xtreg, fe robust- ?

      Thanks again for your help.

      Kind regards,
      Daniel.

      Comment


      • #4
        Daniel:
        as per your last point, yes you should include an -i.date- term in your -xtreg- command in order to control for time fixed-effects.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment

        Working...
        X