Announcement

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

  • xtabond2 command help

    Hello Stata community,
    I am writing to you because I would like you to help me with the xtabond2 command for creating one-step and two-step GMM models. I have read the manual and I am trying to run the code, however, something seems to be wrong. You will understand better by looking at what I show below.
    This is the code I put ant this is Stata outcome:
    Code:
    . xtabond2 NPL_perc L1_NPL_perc NetInterestMargin AvgEquityAvgAssets CosttoIncome ROAA deltabankloans deltaFTSEMIB RealGDPGrowth deltaNC
    > LDeposits L1_RealGDPGrowth L2_RealGDPGrowth, twostep gmmstyle(deltabankloans NetInterestMargin CosttoIncome ROAA) robust small
    Favoring space over speed. To switch, type or click on mata: mata set matafavor speed, perm.
    repeated time values within panel
                     stata():  3598  Stata returned error
             xtabond2_mata():     -  function returned error
                     <istmt>:     -  function returned error
    r(3598);
    This is the list of the variables I use. They are classified as predetermined, exogenous, endogenous (So that you can help me when I have to specify the instruments among the options ):
    Exogenous variables: RealGDPGrowth; deltaFTSEMIB; L1_RealGDPGrowth L2_RealGDPGrowth;
    Predetermined variables: ROAA; Net_Interest_Margin; CosttoIncome; AvgEquityAvgAssets
    Endogenous variables: deltabankloans, deltaNCLDeposits.

    The variables are specified precisely the way they are specified on Stata.
    Could you kindly help me write the code taking into account that I want to estimate both one-step and two-step and taking into account also that I would also like to contain the number of instruments used?

    2) Would you also advise me to introduce temporal dummies for the years ( the dataset runs from 2011 to 2021)?

    If I wanted to use robust error standards for heteroscedasticity and autocorrelation is there an option similar to those for the xtreg command that specifies the cluster or robust option?

    Thank you very much to everyone who would like to help me. It is really important for me since it is my thesis research.
    I thank everyone in advance.
    I wish you all the best.
    Salvatore

  • #2
    The main error message in your output is
    Code:
    repeated time values within panel
    You presumably have used
    Code:
    xtset panelvar timevar
    to tell Stata the variable that identifies panels and the variable that identifies time periods.

    Stata's error message is telling you that you have some pairs of observations where panelvar and timevar have the same values in both observations. This is not allowed for longitudinal data.

    If you do not believe that you have such duplicated data, Start with
    Code:
    duplicates report panelvar timevar
    to see the extent of the problem, and if necessary read the outpout of
    Code:
    help duplicates
    to learn of other subcommands to help you deal with the problem.

    Comment


    • #3
      Hi Williams,
      thanks for your tips.
      I ran the command and this is the outcome:
      my panelvar is id and my timevar is time
      Code:
       duplicates report id year
      
      Duplicates in terms of id year
      
      --------------------------------------
         Copies | Observations       Surplus
      ----------+---------------------------
              1 |         1164             0
              2 |            2             1
      --------------------------------------
      Can you please help me understand the meaning and what I can do next?
      Thanks in advance.
      Salvatore

      Comment


      • #4
        From the output of help duplicates we read

        duplicates report produces a table showing observations that occur as one or more copies and indicating how many observations are "surplus" in the sense that they are the second (third, ...) copy of the first of each group of duplicates.
        You have one case where there are two copies - two observations with the same id and year. You need to examine those two observations and decide whether to keep one and drop the other, or whether they need to be combined in some way into a single observation.

        From the output of help duplicates we further read

        duplicates list lists all duplicated observations.
        so
        Code:
        duplicates list id year
        should identify the duplicated id/year that you need to examine.

        Comment


        • #5
          Thanks a lot William,
          now the command xtabond2 works.

          This is the output
          Code:
          xtabond2 NPL_perc L1_NPL_perc NetInterestMargin AvgEquityAvgAssets CosttoIncome ROAA deltabankloans deltaFTSEMIB RealGDPGrowth deltaNC
          > LDeposits L1_RealGDPGrowth L2_RealGDPGrowth, twostep gmmstyle( deltabankloans NetInterestMargin CosttoIncome ROAA) robust small
          Favoring space over speed. To switch, type or click on mata: mata set matafavor speed, perm.
          Warning: Number of instruments may be large relative to number of observations.
          Warning: Two-step estimated covariance matrix of moments is singular.
            Using a generalized inverse to calculate optimal weighting matrix for two-step estimation.
            Difference-in-Sargan/Hansen statistics may be negative.
          
          Dynamic panel-data estimation, two-step system GMM
          ------------------------------------------------------------------------------
          Group variable: id                              Number of obs      =      1164
          Time variable : year                            Number of groups   =       106
          Number of instruments = 207                     Obs per group: min =         9
          F(11, 105)    =   2792.74                                      avg =     10.98
          Prob > F      =     0.000                                      max =        11
          ------------------------------------------------------------------------------------
                             |              Corrected
                    NPL_perc | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
          -------------------+----------------------------------------------------------------
                 L1_NPL_perc |   .8074002   .0313068    25.79   0.000     .7453246    .8694759
           NetInterestMargin |    .013082   .0040753     3.21   0.002     .0050015    .0211625
          AvgEquityAvgAssets |   .0012891   .0014225     0.91   0.367    -.0015316    .0041098
                CosttoIncome |  -.0005261   .0002213    -2.38   0.019    -.0009649   -.0000873
                        ROAA |  -.0242103   .0061959    -3.91   0.000    -.0364956   -.0119251
              deltabankloans |  -.0014923   .0005445    -2.74   0.007     -.002572   -.0004126
                deltaFTSEMIB |   .0000758   .0001227     0.62   0.538    -.0001673     .000319
               RealGDPGrowth |   .0023978    .000449     5.34   0.000     .0015074    .0032881
            deltaNCLDeposits |  -.0061132   .0006291    -9.72   0.000    -.0073607   -.0048657
            L1_RealGDPGrowth |   .0037429   .0011545     3.24   0.002     .0014537    .0060321
            L2_RealGDPGrowth |  -.0027919    .000757    -3.69   0.000    -.0042929   -.0012908
                       _cons |   .0119697   .0202426     0.59   0.556    -.0281675     .052107
          ------------------------------------------------------------------------------------
          Instruments for first differences equation
            GMM-type (missing=0, separate instruments for each period unless collapsed)
              L(1/10).(deltabankloans NetInterestMargin CosttoIncome ROAA)
          Instruments for levels equation
            Standard
              _cons
            GMM-type (missing=0, separate instruments for each period unless collapsed)
              D.(deltabankloans NetInterestMargin CosttoIncome ROAA)
          ------------------------------------------------------------------------------
          Arellano-Bond test for AR(1) in first differences: z =  -2.03  Pr > z =  0.043
          Arellano-Bond test for AR(2) in first differences: z =   1.25  Pr > z =  0.212
          ------------------------------------------------------------------------------
          Sargan test of overid. restrictions: chi2(195)  = 333.82  Prob > chi2 =  0.000
            (Not robust, but not weakened by many instruments.)
          Hansen test of overid. restrictions: chi2(195)  = 102.89  Prob > chi2 =  1.000
            (Robust, but weakened by many instruments.)
          
          Difference-in-Hansen tests of exogeneity of instrument subsets:
            GMM instruments for levels
              Hansen test excluding group:     chi2(162)  = 100.13  Prob > chi2 =  1.000
              Difference (null H = exogenous): chi2(33)   =   2.75  Prob > chi2 =  1.000
          This is the first time I use the code, so maybe you can be so kind as to help me understand a bit more.

          AR(1) e Ar(2) seems to exclude second-order serial correlation which is what we would like to have.
          However,

          what do you think about instruments? It seems to me that they should be fewer than those here used.
          How can I reduce the number of instruments? To be clear: what kind of options I can specify?

          Please, feel free to notice any kind of problems or points of concern my model could have based on Stata output.

          I am really appreciating your help, William.
          Regards,

          Comment


          • #6
            I am afraid that my expertise includes neither xtabond2 nor finance. In the case of post #1 I was able to help only because I understand the error messages common to many Stata commands, and can discuss them without needed to be familiar with the actual command that caused the error message.

            If by tomorrow nobody ventures an answer, I'd suggest that you start a new topic with a title like "Interpreting xtabond2 output" and post the same thing as post #2, since your question is now substantively different than the discussion to this point.

            Comment


            • #7
              Hi William,
              Thanks a lot for your advice. I truly appreciated your help and understand your point.
              Kind regards,
              Stay safe!

              Comment


              • #8
                You can use the lag() and collapse suboptions of the gmm() option to reduce the number of instruments. The collapse option is usually a good place to start.

                Comment


                • #9
                  Thanks David,
                  Are you familiar with the result interpretation?
                  I would really appreciate that.
                  This is Stata outcome using the laglimits options.
                  Code:
                  xtabond2 NPL_perc L1_NPL_perc NetInterestMargin AvgEquityAvgAssets CosttoIncome ROAA deltabankloans deltaFTSEMIB RealGDPGrowth deltaNC
                  > LDeposits L1_RealGDPGrowth L2_RealGDPGrowth L1_deltabankloans L1_deltaNCLDeposits, twostep ivstyle( RealGDPGrowth deltaFTSEMIB) gmmsty
                  > le( NetInterestMargin ROAA CosttoIncome deltabankloans, laglimits (1 2)) robust small
                  Favoring space over speed. To switch, type or click on mata: mata set matafavor speed, perm.
                  Warning: Two-step estimated covariance matrix of moments is singular.
                    Using a generalized inverse to calculate optimal weighting matrix for two-step estimation.
                    Difference-in-Sargan/Hansen statistics may be negative.
                  
                  Dynamic panel-data estimation, two-step system GMM
                  ------------------------------------------------------------------------------
                  Group variable: id                              Number of obs      =      1197
                  Time variable : year                            Number of groups   =       109
                  Number of instruments = 99                      Obs per group: min =         9
                  F(13, 108)    =   1329.45                                      avg =     10.98
                  Prob > F      =     0.000                                      max =        11
                  -------------------------------------------------------------------------------------
                                      |              Corrected
                             NPL_perc | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
                  --------------------+----------------------------------------------------------------
                          L1_NPL_perc |   .7740458   .0518087    14.94   0.000     .6713519    .8767397
                    NetInterestMargin |   .0145055   .0079409     1.83   0.071    -.0012348    .0302457
                   AvgEquityAvgAssets |  -.0031579   .0017493    -1.81   0.074    -.0066254    .0003095
                         CosttoIncome |  -.0006156   .0002332    -2.64   0.010    -.0010778   -.0001535
                                 ROAA |  -.0235721   .0065619    -3.59   0.000     -.036579   -.0105652
                       deltabankloans |  -.0016769   .0007827    -2.14   0.034    -.0032284   -.0001254
                         deltaFTSEMIB |   .0001474   .0001444     1.02   0.309    -.0001387    .0004336
                        RealGDPGrowth |   .0027212    .000728     3.74   0.000     .0012782    .0041641
                     deltaNCLDeposits |   -.006098   .0007305    -8.35   0.000     -.007546   -.0046501
                     L1_RealGDPGrowth |   .0054768   .0017524     3.13   0.002     .0020033    .0089503
                     L2_RealGDPGrowth |  -.0015179   .0009243    -1.64   0.103      -.00335    .0003141
                    L1_deltabankloans |  -.0001875   .0008188    -0.23   0.819    -.0018105    .0014354
                  L1_deltaNCLDeposits |   -.001297   .0005004    -2.59   0.011    -.0022889   -.0003052
                                _cons |   .0539284   .0299766     1.80   0.075    -.0054904    .1133473
                  -------------------------------------------------------------------------------------
                  Instruments for first differences equation
                    Standard
                      D.(RealGDPGrowth deltaFTSEMIB)
                    GMM-type (missing=0, separate instruments for each period unless collapsed)
                      L(1/2).(NetInterestMargin ROAA CosttoIncome deltabankloans)
                  Instruments for levels equation
                    Standard
                      RealGDPGrowth deltaFTSEMIB
                      _cons
                    GMM-type (missing=0, separate instruments for each period unless collapsed)
                      D.(NetInterestMargin ROAA CosttoIncome deltabankloans)
                  ------------------------------------------------------------------------------
                  Arellano-Bond test for AR(1) in first differences: z =  -2.00  Pr > z =  0.045
                  Arellano-Bond test for AR(2) in first differences: z =   0.55  Pr > z =  0.580
                  ------------------------------------------------------------------------------
                  Sargan test of overid. restrictions: chi2(85)   = 266.72  Prob > chi2 =  0.000
                    (Not robust, but not weakened by many instruments.)
                  Hansen test of overid. restrictions: chi2(85)   =  91.97  Prob > chi2 =  0.284
                    (Robust, but weakened by many instruments.)
                  
                  Difference-in-Hansen tests of exogeneity of instrument subsets:
                    GMM instruments for levels
                      Hansen test excluding group:     chi2(51)   =  71.73  Prob > chi2 =  0.029
                      Difference (null H = exogenous): chi2(34)   =  20.24  Prob > chi2 =  0.970
                    iv(RealGDPGrowth deltaFTSEMIB)
                      Hansen test excluding group:     chi2(83)   =  91.97  Prob > chi2 =  0.234
                      Difference (null H = exogenous): chi2(2)    =   0.00  Prob > chi2 =  1.000
                  
                  
                  .
                  Can you share with me some hints? Thanks

                  Comment

                  Working...
                  X