Announcement

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

  • xtreg, fe and re with lagged values

    I want to perform a regression with YieldSpread as dependent variable and the others as the regressors with the following dataset:

    Code:
     id str20 Name str12 Code float Year double YieldSpread float BidAskSpread double Maturity float RatingScale str3 Currency double(IncomeToSales DebtToAssets TDebtToCap GovernmentBond TermSlope) float Volatility
     1 "TORONTO-DOMINION "    "US89114QBT40" 2012                  .           .                  .  . ""                  .2416                .0167              .6365     .                  .           .
     1 "TORONTO-DOMINION "    "US89114QBT40" 2013                  .           .                  .  4 "USD"                .222  .009300000000000001              .6211 .1167             2.6462           .
     1 "TORONTO-DOMINION "    "US89114QBT40" 2014                  .           .                  .  4 "USD"                 .25  .008100000000000001              .6409 .2183             1.5046           .
     1 "TORONTO-DOMINION "    "US89114QBT40" 2015                  .           .                  .  4 "USD"               .2443 .0078000000000000005               .631 .6023 1.2194999999999998           .
     1 "TORONTO-DOMINION "    "US89114QBT40" 2016                  .           .                  .  4 "USD"                 .26  .009300000000000001              .5561 .8157 1.2539000000000002           .
     1 "TORONTO-DOMINION "    "US89114QBT40" 2017 39.664705882352955 .0011229017  3.699438365540585  4 "USD"                .273                .0074              .6399 .8157 1.2539000000000002  .000878475
     2 "NATIONAL BK.OF ADB."  "XS1587035996" 2012                  .           .                  .  . ""                  .3975                .0635              .6561     .                  .           .
     2 "NATIONAL BK.OF ADB."  "XS1587035996" 2013                  .           .                  .  4 "USD"  .41960000000000003                .0575              .6433 .1167             2.6462           .
     2 "NATIONAL BK.OF ADB."  "XS1587035996" 2014                  .           .                  .  4 "USD"  .44799999999999995  .039900000000000005  .6517000000000001 .2183             1.5046           .
     2 "NATIONAL BK.OF ADB."  "XS1587035996" 2015                  .           .                  .  4 "USD"                 .41  .054900000000000004              .7005 .6023 1.2194999999999998           .
     2 "NATIONAL BK.OF ADB."  "XS1587035996" 2016                  .           .                  .  4 "USD"               .3814                .0696  .6709999999999999 .8157 1.2539000000000002           .
     2 "NATIONAL BK.OF ADB."  "XS1587035996" 2017 116.25680473372785 .0012963397  5.246324060270222  4 "USD"               .4217                .1474                .57 .8157 1.2539000000000002  .001854932
     3 "INVERSIONES CMPC SA " "USP58072AL66" 2012                  .           .                  .  . ""                      0                    0                  0     .                  .           .
     3 "INVERSIONES CMPC SA " "USP58072AL66" 2013                  .           .                  . 10 "USD"               .1175                .3342 .43320000000000003 .1167             2.6462           .
     3 "INVERSIONES CMPC SA " "USP58072AL66" 2014                  .           .                  . 10 "USD"               .1106   .34990000000000004 .47350000000000003 .2183             1.5046           .
     3 "INVERSIONES CMPC SA " "USP58072AL66" 2015                  .           .                  . 10 "USD"  .12380000000000001                .2669 .34600000000000003 .6023 1.2194999999999998           .
     3 "INVERSIONES CMPC SA " "USP58072AL66" 2016                  .           .                  . 10 "USD"               .0437                .2621              .3488 .8157 1.2539000000000002           .
     3 "INVERSIONES CMPC SA " "USP58072AL66" 2017 197.32331288343573 .0039179944   10.2593288515091 10 "USD"  .08310000000000001                 .203              .3674 .8157 1.2539000000000002 .0025837654


    I decide between a fixed effects or random effects model and therefore have to run both regressions and then with a Hausman test determine which one is more suitable. I have used the following command to get started:

    xtset id Year
    panel variable: id (strongly balanced)
    time variable: Year, 2012 to 2017
    delta: 1 unit


    For the following variables (IncomeToSales, DebtToAssets and TDebtToCap), i want to use the values of the previous year. So, in the regression for YieldSpread in 2017, i want to use the values for the accounting ratios in 2016.

    I was wondering if the following command is correct to use:

    Code:
     xtreg YieldSpread BidAskSpread Maturity RatingScale L.IncomeToSales L.DebtToAsses L.DebtToCap GovernmentBond Termslope Volatility, fe
    I have to do the same for the random effects regression.

    Thanks in advance.

    Last edited by Abhinaya Chandra; 21 Dec 2017, 07:27.

  • #2
    There are several problems with your proposed command:

    1. Several of the variable names have typographical errors, causing Stata to complain that they aren't found.

    2. You have mostly missing values for several of these variables in your example. In fact, for these variables, in the example, the offending variables are missing for all but one observation per id. Thus each id's group of observations is reduced to a single observation in the estimation sample. As your "panel" reduces to a single observation per panel, you get useless meaningless results. If your example data is representative of your real data, you are going to have difficulty fitting any models involving these variables.

    In addition, in this small sample of the data, the number of predictor variables exceeds the number of observations in the sample (though presumably that won't be true in your full data sample.)

    Comment


    • #3
      I typed the command in this forum, and now see the typos. However in Stata itself there aren't any typos, so disregarding that I was wondering whether this was the right method to estimate the models. I ran the following command and got these results:

      Code:
      xtreg YieldSpread BidAskSpread Maturity L.IncomeToSales L.DebtToAssets L.TDebtToCap GovernmentBond TermSlope Volatility, fe
      estimates store fixed
      xtreg YieldSpread BidAskSpread Maturity L.IncomeToSales L.DebtToAssets L.TDebtToCap GovernmentBond TermSlope Volatility, re
      estimates store random
      hausman fixed random
      Code:
      Fixed-effects (within) regression               Number of obs     =        244
      Group variable: id                              Number of groups  =         94
      
      R-sq:                                           Obs per group:
           within  = 0.9246                                         min =          1
           between = 0.1080                                         avg =        2.6
           overall = 0.2211                                         max =          5
      
                                                      F(8,142)          =     217.71
      corr(u_i, Xb)  = -0.6727                        Prob > F          =     0.0000
      
      --------------------------------------------------------------------------------
         YieldSpread |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      ---------------+----------------------------------------------------------------
        BidAskSpread |  -31517.59   5520.798    -5.71   0.000    -42431.16   -20604.02
            Maturity |  -15.12286   5.295152    -2.86   0.005    -25.59038   -4.655346
                     |
       IncomeToSales |
                 L1. |  -60.41827    46.4877    -1.30   0.196    -152.3157    31.47913
                     |
        DebtToAssets |
                 L1. |  -593.6171   193.4998    -3.07   0.003    -976.1297   -211.1045
                     |
          TDebtToCap |
                 L1. |  -1279.824   59.91994   -21.36   0.000    -1398.275   -1161.374
                     |
      GovernmentBond |   83.77058    25.8428     3.24   0.001     32.68425    134.8569
           TermSlope |    60.7266   24.14964     2.51   0.013     12.98734    108.4659
          Volatility |    2680.62    2285.38     1.17   0.243    -1837.144    7198.384
               _cons |    1483.59   73.87932    20.08   0.000     1337.544    1629.635
      ---------------+----------------------------------------------------------------
             sigma_u |  268.42752
             sigma_e |  40.289709
                 rho |  .97796776   (fraction of variance due to u_i)
      --------------------------------------------------------------------------------
      F test that all u_i=0: F(93, 142) = 18.06                    Prob > F = 0.0000
      Code:
      Random-effects GLS regression                   Number of obs     =        244
      Group variable: id                              Number of groups  =         94
      
      R-sq:                                           Obs per group:
           within  = 0.8751                                         min =          1
           between = 0.4650                                         avg =        2.6
           overall = 0.5818                                         max =          5
      
                                                      Wald chi2(8)      =     849.14
      corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000
      
      --------------------------------------------------------------------------------
         YieldSpread |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      ---------------+----------------------------------------------------------------
        BidAskSpread |   5138.745   5268.904     0.98   0.329    -5188.117    15465.61
            Maturity |   -3.05298   3.058063    -1.00   0.318    -9.046672    2.940713
                     |
       IncomeToSales |
                 L1. |  -305.4437   43.35851    -7.04   0.000    -390.4248   -220.4626
                     |
        DebtToAssets |
                 L1. |   42.11579   78.11188     0.54   0.590    -110.9807    195.2123
                     |
          TDebtToCap |
                 L1. |  -1263.287   62.01238   -20.37   0.000    -1384.829   -1141.745
                     |
      GovernmentBond |   39.65099   21.07989     1.88   0.060    -1.664838    80.96682
           TermSlope |   20.62278    29.5032     0.70   0.485    -37.20243    78.44799
          Volatility |   185.2121   3007.763     0.06   0.951    -5709.895    6080.319
               _cons |   1128.878   62.94374    17.93   0.000     1005.511    1252.246
      ---------------+----------------------------------------------------------------
             sigma_u |  84.244628
             sigma_e |  40.289709
                 rho |  .81385518   (fraction of variance due to u_i)
      Code:
                       ---- Coefficients ----
                   |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
                   |     fixed        random       Difference          S.E.
      -------------+----------------------------------------------------------------
      BidAskSpread |   -31517.59     5138.745       -36656.34        1648.592
          Maturity |   -15.12286     -3.05298       -12.06988        4.322833
      IncomeToSa~s |
               L1. |   -60.41827    -305.4437        245.0254         16.7674
      DebtToAssets |
               L1. |   -593.6171     42.11579       -635.7329        177.0331
        TDebtToCap |
               L1. |   -1279.824    -1263.287       -16.53698               .
      Government~d |    83.77058     39.65099        44.11959        14.94953
         TermSlope |     60.7266     20.62278        40.10382               .
        Volatility |     2680.62     185.2121        2495.408               .
      ------------------------------------------------------------------------------
                                 b = consistent under Ho and Ha; obtained from xtreg
                  B = inconsistent under Ha, efficient under Ho; obtained from xtreg
      
          Test:  Ho:  difference in coefficients not systematic
      
                        chi2(8) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                                =  -737.14    chi2<0 ==> model fitted on these
                                              data fails to meet the asymptotic
                                              assumptions of the Hausman test;
                                              see suest for a generalized test
      Now, if i run just a normal regression, i get more significant and plausible results. I was wondering how i should exactly interpret this and whether I am actually doing it right.


      Comment


      • #4
        The commands you show are valid commands that estimate well-specified models. Whether these models are appropriate to answer your research question is a substantive question that an outisder cannot answer.

        As for the comparison with ordinary least squares regression (which is what I assume you mean by "just a normal regression"), you cannot use the OLS regression here. You do have panel data, and the outputs from -xtreg- clearly show that the panel-level variance components or fixed effects are quite large. Ignoring them would lead to a very biased model.

        Comment


        • #5
          I tried to replicate the model, but there is not much information in the dataset to work with.

          Anyway, the huge difference in the coefficients shall give a hint.

          That said, albeit the (potential) misspecification of the model, I strongly recommend you try again, now with the - sigmamore - option.
          Last edited by Marcos Almeida; 21 Dec 2017, 11:48.
          Best regards,

          Marcos

          Comment


          • #6
            Originally posted by Marcos Almeida View Post
            I tried to replicate the model, but there is not much information in the dataset to work with.

            Anyway, the huge difference in the coefficients shall give a hint.

            That said, albeit the (potential) misspecification of the model, I strongly recommend you try again, now with the - sigmamore - option.
            Could you perhaps elaborate on the sigmamore option? I tried looking it up, but could not find any source explaining what this exactly entails. Also I tried uploading my dataset in here, but it would not load for some reason.


            Comment


            • #7
              Originally posted by Clyde Schechter View Post
              The commands you show are valid commands that estimate well-specified models. Whether these models are appropriate to answer your research question is a substantive question that an outisder cannot answer.

              As for the comparison with ordinary least squares regression (which is what I assume you mean by "just a normal regression"), you cannot use the OLS regression here. You do have panel data, and the outputs from -xtreg- clearly show that the panel-level variance components or fixed effects are quite large. Ignoring them would lead to a very biased model.
              I am just confused about the outcome of the Hausman test, and which model it recommends. Especially since it mentions that:
              Code:
              chi2(8) = (b-B)'[(V_b-V_B)^(-1)](b-B)                           =  -737.14    chi2<0 ==> model fitted on these data fails to meet the asymptotic assumptions of the Hausman test;

              Comment


              • #8
                Originally posted by Marcos Almeida View Post
                I tried to replicate the model, but there is not much information in the dataset to work with.
                This is the dataset that I am working with.
                Attached Files

                Comment


                • #9
                  Abhinaya Chandra I wonder whether you tried - hausman - with the - sigmamore - option.

                  With regards to information about it, this is what we get in the Stata Manaul:
                  ​​​​​​​
                  sigmamore and sigmaless specify that the two covariance matrices used in
                  the test be based on a common estimate of disturbance variance
                  (sigma2).

                  sigmamore specifies that the covariance matrices be based on the
                  estimated disturbance variance from the efficient estimator.
                  This option provides a proper estimate of the contrast variance
                  for so-called tests of exogeneity and overidentification in
                  instrumental-variables regression.
                  Best regards,

                  Marcos

                  Comment

                  Working...
                  X