Announcement

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

  • Entity fixed effects model - repeated time values within panel

    Hello, I want to run a regression in which the explained variable is the bond coupon and there are some explanatory variables, such as size of the issuance, tenor, etc. I want to know if one specific characteristic has a significant impact on the coupon rate, this characteristic will be identified with a dummy variable. My database, so it is not complete yet, so this variable is not there yet.

    I thought the best way to run this regression was through an entity fixed effects model, controlilng both for issuers id and month of the issuance, something like: π‘Œπ‘–π‘‘ = 𝛼𝑖 + 𝛽𝑋𝑖𝑑 + 𝑒𝑖 + 𝑒𝑖𝑑. However, as you can see below, I have more than one time period for each issuer (one issuer issued more than one bond in the same month). So, when I tried to use 'xtset id month', I got the error message 'repeated time values within panel'. I know this is probably more of an lack of knowledge regarging which is the most appropriate model, but I would like to know if there is any advice you could give me?

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str6 ticker double(coupon issuedate size) byte tenor float(mnth id logsize)
    "ACCES"    15.5 21625.874675925923   33998957  5 21625  1  17.34184
    "ADB"       4.4 18366.874675925923  367149939  2 18366  2  19.72128
    "ADB"      7.18 18366.874675925923  195806943  3 18366  2  19.09264
    "ADB"        .5 18533.874675925923   56103825  7 18533  2 17.842714
    "ADB"        .5 18533.874675925923   30614167  7 18533  2 17.236973
    "ADB"      4.35 18533.874675925923  104088416  4 18533  2  18.46075
    "ADB"      7.02 18533.874675925923   15312514  4 18533  2 16.544182
    "ADB"      3.14 19133.874675925923   14366736  4 19133  2 16.480427
    "ADB"      2.81 19387.916342592594   28223921  4 19387  2  17.15568
    "ADB"      3.41 19584.874675925923   30717117  4 19584  2  17.24033
    "ADB"     2.125 20165.874675925923  5.000e+08 10 20165  2  20.03012
    "ADB"      6.71 20221.874675925923    2338831  3 20221  2 14.665162
    "ADB"         1 20681.874675925923  8.000e+08  3 20681  2  20.50012
    "ADB"      1.75 20681.874675925923  5.000e+08 10 20681  2  20.03012
    "ADB"     2.625 20907.874675925923   50000000 10 20907  2 17.727533
    "ADB"         6 20962.874675925923   83070277  4 20962  2 18.235197
    "ADB"      1.57 20963.874675925923   10200000  5 20963  2 16.137897
    "ADB"         2 20963.874675925923   40564903  5 20963  2 17.518414
    "ADB"      9.55 20963.874675925923   49547852  4 20963  2 17.718449
    "ADB"     1.875 21040.874675925923  7.500e+08  5 21040  2 20.435583
    "ADB"     2.375 21040.874675925923  5.000e+08 10 21040  2  20.03012
    "ADB"      3.18 21137.916342592594   16889951 10 21137  2  16.64223
    "ADB"      1.47 21209.916342592594   23864070 10 21209  2 16.987885
    "ADB"      1.95 21264.874675925923   12903558  2 21264  2 16.373014
    "ADB"      2.25 21303.874675925923   12903558  2 21303  2 16.373014
    "ADB"       .37 21360.874675925923  334096983  5 21360  2  19.62694
    "ADB"       .35 21380.874675925923  620880201  7 21380  2  20.24665
    "ADB"     3.125 21452.874675925923  7.500e+08 10 21452  2 20.435583
    "ADB"      2.45 21565.916342592594  749913861  5 21565  2  20.43547
    "ADB"      .295 21737.874675925923  467735777  7 21737  2 19.963413
    "ADB"       1.6 21809.874675925923  148631576 11 21809  2  18.81698
    "ADB"       1.5 21825.874675925923   98006546  3 21825  2 18.400545
    "ADB"      .625 21839.874675925923  296450889  7 21839  2 19.507393
    "ADB"         0 21845.874675925923  776100251 10 21845  2  20.46979
    "ADB"        .8 22117.874675925923   50000000 10 22117  2 17.727533
    "ADB"       .29 22200.874675925923   47728140  8 22200  2 17.681032
    "ADB"     10.12 22236.874675925923    8336391  2 22236  2  15.93614
    "ADB"      10.1 22236.874675925923   21945745  2 22236  2 16.904083
    "ADB"      .253 22300.874675925923  143184421  7 22300  2 18.779644
    "ADB"      .603 22312.874675925923   36218011 30 22312  2 17.405067
    "ADB"         6 22315.874675925923   75011720  5 22315  2 18.133156
    "ADB"       .75 22320.874675925923  941477743  5 22320  2  20.66296
    "ADB"      .715 22333.874675925923   41392013 30 22333  2 17.538599
    "ADB"       .92 22334.874675925923   51740016 40 22334  2 17.761742
    "ADB"     .8325 22342.874675925923   36218011 30 22342  2 17.405067
    "ADB"       4.7 22350.874675925923   53843392  3 22350  2  17.80159
    "ADB"      2.15 22532.874675925923  133606703 10 22532  2 18.710411
    "ADB"       1.8 22532.874675925923  140524399 15 22532  2 18.760891
    "ADB"        .6 22627.874675925923   38367096  2 22627  2 17.462711
    "ADB"      14.5 22936.874675925923    7337761  2 22936  2 15.808544
    "ADNA"    4.375 22530.874675925923  7.500e+08  3 22530  3 20.435583
    "ADNA"    4.375 22530.874675925923  7.500e+08  3 22530  3 20.435583
    "ADNARE"  4.625 21836.874675925923  3.625e+08 20 21836  4 19.708534
    "ADNARE"  4.625 21836.874675925923  3.625e+08 20 21836  4 19.708534
    "ADNGN"    6.25 21709.874675925923  5.000e+08  6 21709  5  20.03012
    "ADNGN"    6.25 21709.874675925923  5.000e+08  6 21709  5  20.03012
    "AESOC"  4.7133 21655.874675925923  120223159 10 21655  6  18.60486
    "AESOC"  4.7133 21655.874675925923   33550867 10 21655  6 17.328573
    "AFDB"     4.52 18349.874675925923   61384460  4 18349  7 17.932667
    "AFDB"     4.68 18408.874675925923   56611583  4 18408  7 17.851725
    "AFDB"     4.35 18408.874675925923   26820632  4 18408  7 17.104683
    "AFDB"       .5 18470.874675925923    7135164  7 18470  7 15.780546
    "AFDB"     4.42 18499.874675925923   11462412  3 18499  7 16.254583
    "AFDB"       .5 18533.874675925923    7514248 10 18533  7 15.832312
    "AFDB"       .5 18562.916342592594    6154319  6 18562  7 15.632665
    "AFDB"     3.71 18562.916342592594   28560046  4 18562  7 17.167519
    "AFDB"      4.8 18562.916342592594   45594931  4 18562  7 17.635307
    "AFDB"      .75 19648.874675925923  5.000e+08  3 19648  7  20.03012
    "AFDB"     1.75 19793.874675925923   89266585  5 19793  7 18.307138
    "AFDB"    1.375 20438.916342592594  5.000e+08  3 20438  7  20.03012
    "AFDB"     .375 20788.916342592594  114729422  6 20788  7 18.558086
    "AFDB"      3.5 20802.916342592594   94583730 15 20802  7 18.364996
    "AFDB"        3 21523.916342592594  5.000e+08  3 21523  7  20.03012
    "AFDB"     .375 21649.874675925923  190912562  5 21649  7 19.067326
    "AFDB"      .25 22391.874675925923   95456281  5 22391  7  18.37418
    "AFDB"     .823 22685.874675925923  143184421  5 22685  7 18.779644
    "AFFNN"   1.205 22187.874675925923  158881474  5 22187  8 18.883669
    "AGBKC"    4.15 20380.916342592594   85178875  2 20380  9 18.260263
    "AGBKC"    2.75 20380.916342592594  5.000e+08  5 20380  9  20.03012
    "AGBKC"   2.125 20380.916342592594  4.000e+08  3 20380  9 19.806974
    "AGBKC"     2.4 22937.874675925923 2071851821  3 22937  9  21.45171
    "AGBKC"     2.4 22937.874675925923 2129471890  3 22937  9  21.47914
    "AGBKC"     2.8 22937.874675925923  690617273  5 22937  9 20.353096
    "AGBKC"     2.8 22937.874675925923  709823963  5 22937  9  20.38053
    "AGBKCK"   2.25 22704.874675925923  3.000e+08  5 22704 10  19.51929
    "AGBKCK"      2 22704.874675925923  6.000e+08  3 22704 10  20.21244
    "AGBKFH"   3.68 21702.874675925923  483691533  3 21702 11  19.99696
    "AGDBC"    3.79 20808.916342592594 1612305112  3 20808 12  21.20093
    "AGDBC"    4.48 21138.916342592594 1612305112  2 21138 12  21.20093
    "AGDBC"    3.18 21858.874675925923  348063375  3 21858 12 19.667894
    "AGDBC"       2 22545.874675925923 1419647927  2 22545 12 21.073675
    "AGSPA"      .5 22572.874675925923  103480033  5 22572 13  18.45489
    "AGUA"     8.65 20997.874675925923  206675622 10 20997 14  19.14666
    "AGUAS"     1.8 21257.874675925923   57039000  7 21257 15 17.859245
    "AGUAS"     2.5 21622.874675925923   76052000 25 21622 15 18.146929
    "AHWLIA"   3.99 21739.874675925923   85178875  3 21739 16 18.260263
    "AHWLIA"    3.8 22822.874675925923   88018171  3 22822 16 18.293055
    "AIAUT"    1.75 22656.874675925923  1.000e+09  5 22656 17 20.723267
    "AIAUT"    1.75 22656.874675925923  1.000e+09  5 22656 17 20.723267
    "AJBAN"     4.6 21502.916342592594   41437036  3 21502 18 17.539686
    end
    format %tdnn/dd/CCYY issuedate
    Thanks a lot!

  • #2
    Renato:
    you can easily fix this issue just -xtset-ting your dataset with -panelid- only.
    However, this fix comes at the cost of making time-series operator (such as lags and leads) unavailable.
    You can still add -timevar- among your predictors, though.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hello, Carlo. Thanks for the reply.

      I don't think running the regression without identifing which month the bond was issued is a good idea, because a lot can change in a company that could influence the bond coupons during time, so the idea use the issuers id and the month of the issuance as controls so I can control for unobserved factors of the companies, as well as for macreconomic factors that might influence the regression. Maybe I'm running the wrong type of regression, but I'm not sure.

      Comment


      • #4
        Renato:
        omitting the -timevar- in -xtset- is not detrimental to use -i.month- as a predictor.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thanks, Carlo.

          So you mean that I could run a regression like that?

          Code:
          *set the panel data
          xtset id
          
          * Fixed effects within estimator
          xtreg coupon mnth size tenor, fe
          I'm not sure if I understood it correcly, because, to me, this would generate a result in which the interpretation would be that, for one adittional month, the coupon rate would increase/decrease in a certain amount, given a certain issuer. But that does not make much sense in my point of view, since I was trying to compare the same issuer in a given period.

          Kind regards,
          Renato.

          Comment


          • #6
            Renato:
            I do not know if I got you last reply right.
            That said, the -fe- estimator accounts for within-panel variation.
            In addition, I would use cluster-robust standard errors.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Renato:
              as an aside to my previous reply (ans setting aside for a while the correct format of -mnth-), you should better coding -i.mnth- (that is, as categorical, not continuous):
              Code:
              .
              . xtreg coupon i.mnth size tenor, fe r
              note: 20997.mnth omitted because of collinearity.
              note: 21502.mnth omitted because of collinearity.
              note: 21622.mnth omitted because of collinearity.
              note: 21625.mnth omitted because of collinearity.
              note: 21655.mnth omitted because of collinearity.
              note: 21702.mnth omitted because of collinearity.
              note: 21709.mnth omitted because of collinearity.
              note: 21836.mnth omitted because of collinearity.
              note: 22187.mnth omitted because of collinearity.
              note: 22530.mnth omitted because of collinearity.
              note: 22545.mnth omitted because of collinearity.
              note: 22572.mnth omitted because of collinearity.
              note: 22656.mnth omitted because of collinearity.
              note: 22704.mnth omitted because of collinearity.
              note: 22822.mnth omitted because of collinearity.
              note: 22937.mnth omitted because of collinearity.
              
              Fixed-effects (within) regression               Number of obs     =        100
              Group variable: id                              Number of groups  =         18
              
              R-squared:                                      Obs per group:
                   Within  = 0.8542                                         min =          1
                   Between = 0.0090                                         avg =        5.6
                   Overall = 0.4630                                         max =         49
              
                                                              F(2,17)           =          .
              corr(u_i, Xb) = -0.3237                         Prob > F          =          .
              
                                                  (Std. err. adjusted for 18 clusters in id)
              ------------------------------------------------------------------------------
                           |               Robust
                    coupon | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
              -------------+----------------------------------------------------------------
                      mnth |
                    18366  |   .0410875   .4010583     0.10   0.920    -.8050715    .8872465
                    18408  |  -.0305246   .0180479    -1.69   0.109    -.0686024    .0075532
                    18470  |  -2.955321   .3560841    -8.30   0.000    -3.706593   -2.204049
                    18499  |  -.5431469   .1301442    -4.17   0.001    -.8177272   -.2685666
                    18533  |  -1.819748   .7103941    -2.56   0.020    -3.318548   -.3209471
                    18562  |  -1.309348   .0831934   -15.74   0.000     -1.48487   -1.133825
                    19133  |  -2.388017   .5348245    -4.47   0.000    -3.516398   -1.259636
                    19387  |  -2.700033   .5338682    -5.06   0.000    -3.826397    -1.57367
                    19584  |  -2.096798   .5337282    -3.93   0.001    -3.222866   -.9707298
                    19648  |  -3.579146   .4116532    -8.69   0.000    -4.447659   -2.710634
                    19793  |  -2.355455   .1231306   -19.13   0.000    -2.615238   -2.095673
                    20165  |  -.5026225   1.321585    -0.38   0.708    -3.290923    2.285678
                    20221  |   .7880138   .4195878     1.88   0.078    -.0972392    1.673267
                    20380  |   -1.23516   .9923497    -1.24   0.230    -3.328834    .8585154
                    20438  |  -2.954146   .4116532    -7.18   0.000    -3.822659   -2.085634
                    20681  |  -2.382221   .9987259    -2.39   0.029    -4.489349   -.2750938
                    20788  |  -3.319051   .2456609   -13.51   0.000     -3.83735   -2.800751
                    20802  |   3.185049   1.307988     2.44   0.026     .4254365    5.944662
                    20808  |   2.418382    .219648    11.01   0.000     1.954965    2.881798
                    20907  |  -.5866109   1.243696    -0.47   0.643     -3.21058    2.037358
                    20962  |   .5611436    .533051     1.05   0.307    -.5634958    1.685783
                    20963  |  -.8776937   .6121818    -1.43   0.170    -2.169284     .413897
                    20997  |          0  (omitted)
                    21040  |  -1.286305   1.091576    -1.18   0.255    -3.589329     1.01672
                    21137  |  -.0745795     1.2432    -0.06   0.953    -2.697502    2.548343
                    21138  |   2.730021   .1767847    15.44   0.000     2.357038    3.103004
                    21209  |  -1.775529   1.243243    -1.43   0.171    -4.398542    .8474842
                    21257  |  -7.535162   2.137592    -3.53   0.003    -12.04509   -3.025237
                    21264  |  -4.336636   .3029063   -14.32   0.000    -4.975713    -3.69756
                    21303  |  -4.036636   .3029063   -13.33   0.000    -4.675713    -3.39756
                    21360  |  -4.364726   .6993668    -6.24   0.000    -5.840261   -2.889191
                    21380  |  -3.255831   1.036531    -3.14   0.006    -5.442721   -1.068942
                    21452  |   .8218154    1.41596     0.58   0.569      -2.1656    3.809231
                    21502  |          0  (omitted)
                    21523  |  -1.329146   .4116532    -3.23   0.005    -2.197659    -.460634
                    21565  |  -1.745099   .9106854    -1.92   0.072    -3.666477    .1762796
                    21622  |          0  (omitted)
                    21625  |          0  (omitted)
                    21649  |  -3.598544   .1736862   -20.72   0.000     -3.96499   -3.232098
                    21655  |          0  (omitted)
                    21702  |          0  (omitted)
                    21709  |          0  (omitted)
                    21737  |  -3.509575   .9715323    -3.61   0.002    -5.559329   -1.459821
                    21739  |   .1863153   .0026054    71.51   0.000     .1808184    .1918122
                    21809  |  -1.105251   1.368187    -0.81   0.430    -3.991873     1.78137
                    21825  |  -4.297833   .4149794   -10.36   0.000    -5.173363   -3.422303
                    21836  |          0  (omitted)
                    21839  |   -3.40186   .9190663    -3.70   0.002     -5.34092     -1.4628
                    21845  |  -2.269313    1.42758    -1.59   0.130    -5.281243    .7426174
                    21858  |   .1677096   .9822413     0.17   0.866    -1.904638    2.240058
                    22117  |  -2.411611   1.243696    -1.94   0.069     -5.03558    .2123579
                    22187  |          0  (omitted)
                    22200  |   -3.68128   1.006534    -3.66   0.002    -5.804882   -1.557678
                    22236  |   3.826267   .3024769    12.65   0.000     3.188097    4.464438
                    22300  |  -3.972762   .8932017    -4.45   0.000    -5.857253   -2.088271
                    22312  |   4.940712   3.616021     1.37   0.190    -2.688425    12.56985
                    22315  |    .929046   .6514251     1.43   0.172    -.4453408    2.303433
                    22320  |  -3.196496   1.041183    -3.07   0.007    -5.393199   -.9997928
                    22333  |   5.059427    3.61627     1.40   0.180    -2.570236    12.68909
                    22334  |    9.06146   4.803544     1.89   0.076    -1.073133    19.19605
                    22342  |   5.170212   3.616021     1.43   0.171    -2.458925    12.79935
                    22350  |  -1.155146    .414811    -2.78   0.013    -2.030321   -.2799715
                    22391  |  -3.847423   .1248095   -30.83   0.000    -4.110748   -3.584098
                    22530  |          0  (omitted)
                    22532  |  -.1777203   1.545177    -0.12   0.910    -3.437759    3.082318
                    22545  |          0  (omitted)
                    22572  |          0  (omitted)
                    22627  |  -5.653591    .298818   -18.92   0.000    -6.284042    -5.02314
                    22656  |          0  (omitted)
                    22685  |  -3.212484   .1447552   -22.19   0.000     -3.51789   -2.907077
                    22704  |          0  (omitted)
                    22822  |          0  (omitted)
                    22936  |   8.206141   .3040318    26.99   0.000      7.56469    8.847592
                    22937  |          0  (omitted)
                           |
                      size |  -1.30e-09   9.18e-10    -1.41   0.175    -3.23e-09    6.38e-10
                     tenor |  -.3783604    .118684    -3.19   0.005    -.6287619    -.127959
                     _cons |   6.894532   .4296142    16.05   0.000     5.988126    7.800939
              -------------+----------------------------------------------------------------
                   sigma_u |  3.9407057
                   sigma_e |  1.8779197
                       rho |  .81493336   (fraction of variance due to u_i)
              ------------------------------------------------------------------------------
              Then you can test the joint statistical significance of -i.mnth- via:
              Code:
              . testparm i.mnth
              
               ( 1)  18366.mnth = 0
               ( 2)  18408.mnth = 0
               ( 3)  18470.mnth = 0
               ( 4)  18499.mnth = 0
               ( 5)  18533.mnth = 0
               ( 6)  18562.mnth = 0
               ( 7)  19133.mnth = 0
               ( 8)  19387.mnth = 0
               ( 9)  19584.mnth = 0
               (10)  19648.mnth = 0
               (11)  19793.mnth = 0
               (12)  20165.mnth = 0
               (13)  20221.mnth = 0
               (14)  20380.mnth = 0
               (15)  20438.mnth = 0
               (16)  20681.mnth = 0
               (17)  20788.mnth = 0
               (18)  20802.mnth = 0
               (19)  20808.mnth = 0
               (20)  20907.mnth = 0
               (21)  20962.mnth = 0
               (22)  20963.mnth = 0
               (23)  21040.mnth = 0
               (24)  21137.mnth = 0
               (25)  21138.mnth = 0
               (26)  21209.mnth = 0
               (27)  21257.mnth = 0
               (28)  21264.mnth = 0
               (29)  21303.mnth = 0
               (30)  21360.mnth = 0
               (31)  21380.mnth = 0
               (32)  21452.mnth = 0
               (33)  21523.mnth = 0
               (34)  21565.mnth = 0
               (35)  21649.mnth = 0
               (36)  21737.mnth = 0
               (37)  21739.mnth = 0
               (38)  21809.mnth = 0
               (39)  21825.mnth = 0
               (40)  21839.mnth = 0
               (41)  21845.mnth = 0
               (42)  21858.mnth = 0
               (43)  22117.mnth = 0
               (44)  22200.mnth = 0
               (45)  22236.mnth = 0
               (46)  22300.mnth = 0
               (47)  22312.mnth = 0
               (48)  22315.mnth = 0
               (49)  22320.mnth = 0
               (50)  22333.mnth = 0
               (51)  22334.mnth = 0
               (52)  22342.mnth = 0
               (53)  22350.mnth = 0
               (54)  22391.mnth = 0
               (55)  22532.mnth = 0
               (56)  22627.mnth = 0
               (57)  22685.mnth = 0
               (58)  22936.mnth = 0
                     Constraint 1 dropped
                     Constraint 2 dropped
                     Constraint 3 dropped
                     Constraint 4 dropped
                     Constraint 5 dropped
                     Constraint 6 dropped
                     Constraint 7 dropped
                     Constraint 8 dropped
                     Constraint 9 dropped
                     Constraint 10 dropped
                     Constraint 11 dropped
                     Constraint 12 dropped
                     Constraint 13 dropped
                     Constraint 15 dropped
                     Constraint 16 dropped
                     Constraint 17 dropped
                     Constraint 18 dropped
                     Constraint 19 dropped
                     Constraint 20 dropped
                     Constraint 21 dropped
                     Constraint 22 dropped
                     Constraint 23 dropped
                     Constraint 24 dropped
                     Constraint 25 dropped
                     Constraint 26 dropped
                     Constraint 27 dropped
                     Constraint 28 dropped
                     Constraint 29 dropped
                     Constraint 30 dropped
                     Constraint 31 dropped
                     Constraint 32 dropped
                     Constraint 33 dropped
                     Constraint 34 dropped
                     Constraint 35 dropped
                     Constraint 36 dropped
                     Constraint 37 dropped
                     Constraint 38 dropped
                     Constraint 39 dropped
                     Constraint 40 dropped
                     Constraint 41 dropped
                     Constraint 42 dropped
                     Constraint 43 dropped
                     Constraint 44 dropped
                     Constraint 45 dropped
                     Constraint 46 dropped
                     Constraint 47 dropped
                     Constraint 48 dropped
                     Constraint 49 dropped
                     Constraint 50 dropped
                     Constraint 52 dropped
                     Constraint 53 dropped
                     Constraint 54 dropped
                     Constraint 55 dropped
                     Constraint 56 dropped
                     Constraint 57 dropped
                     Constraint 58 dropped
              
                     F(  2,    17) =    2.27
                          Prob > F =    0.1334
              Kind regards,
              Carlo
              (Stata 19.0)

              Comment

              Working...
              X