Announcement

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

  • Help with Dynamic Panel Models (xtabond2)

    Dear Stata members

    I am learning GMM (due to an urgent requirement, hence I am not getting sufficient time to know it in reasonable depth), and I have some doubts (which could be trivial for many in this forum) and I wish if someone could help me (at least by showing some related posts in this forum) with this issue. To give the back ground, let me display the results based on OLS which I did using userwritten command
    Code:
    -reghdfe-
    Code:
     reghdfe DEP_VAR KEY_INDEP_VAR ///
    > Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9   ///
    > Macro_C1 Macro_C2 Macro_C3 ///
    > , absorb (id year) cluster (id)
    (dropped 1318 singleton observations)
    (MWFE estimator converged in 7 iterations)
    
    HDFE Linear regression                            Number of obs   =    136,205
    Absorbing 2 HDFE groups                           F(  13,  14309) =     364.51
    Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                      R-squared       =     0.4609
                                                      Adj R-squared   =     0.3975
                                                      Within R-sq.    =     0.0717
    Number of clusters (id)      =     14,310         Root MSE        =     0.1899
    
                                     (Std. err. adjusted for 14,310 clusters in id)
    -------------------------------------------------------------------------------
                  |               Robust
          DEP_VAR | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    --------------+----------------------------------------------------------------
    KEY_INDEP_VAR |  -.0077237   .0027593    -2.80   0.005    -.0131324    -.002315
          Firm_C1 |   .0003868   .0020274     0.19   0.849    -.0035872    .0043608
          Firm_C2 |   .0732736   .0083623     8.76   0.000     .0568824    .0896648
          Firm_C3 |   .0019558   .0026936     0.73   0.468    -.0033241    .0072357
          Firm_C4 |   .0604588   .0024701    24.48   0.000     .0556171    .0653004
          Firm_C5 |  -.0011158   .0004712    -2.37   0.018    -.0020394   -.0001923
          Firm_C6 |   1.223736   .0219559    55.74   0.000       1.1807    1.266773
          Firm_C7 |  -.0534154   .0228991    -2.33   0.020    -.0983006   -.0085303
          Firm_C8 |   .0100359   .0084078     1.19   0.233    -.0064445    .0265163
          Firm_C9 |  -.0084562   .0053741    -1.57   0.116    -.0189901    .0020777
         Macro_C1 |  -.0375138   .0038234    -9.81   0.000    -.0450082   -.0300193
         Macro_C2 |   .0065364   .0002482    26.33   0.000     .0060498     .007023
         Macro_C3 |   .0024007   .0001674    14.34   0.000     .0020726    .0027289
            _cons |  -.2131295   .0356505    -5.98   0.000    -.2830091     -.14325
    -------------------------------------------------------------------------------
    
    Absorbed degrees of freedom:
    -----------------------------------------------------+
     Absorbed FE | Categories  - Redundant  = Num. Coefs |
    -------------+---------------------------------------|
              id |     14310       14310           0    *|
            year |        19           0          19     |
    -----------------------------------------------------+
    * = FE nested within cluster; treated as redundant for DoF computation
    In the above results, Firm_C1 to Firm_C9 are firm-level controls & Marco_C1 to Marco_C9 are macro-level (country-level controls like GDP, Unemployment, and Inflation). DEP_VAR is a firm_level outcome (say Return on assets) and KEY_INDEP_VAR is a country level variable monetary policy changes. There are 19 countries and panel identifier (id) is a firm-level unique code. I used firm fixed effects and year dummies.

    Endogeneity issue was raised and I was asked to solve by GMM. Based on David Roodman (2009) I did some basic codes and here are my results

    Code:
     xtabond2 DEP_VAR KEY_INDEP_VA i.year Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 F
    > irm_C9 Macro_C1 Macro_C2 Macro_C3, gmm(l.DEP_VAR, lag(1 3))  gmm (Firm_C1, lag (1 3)) gmm( Firm_C2 Fir
    > m_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9, lag(2 10) collapse) iv(Macro_C1 Macro_C2 Macro_C
    > 3 i.year) twostep robust
    Favoring space over speed. To switch, type or click on mata: mata set matafavor speed, perm.
    1999b.year dropped due to collinearity
    2001.year dropped due to collinearity
    2018.year dropped due to collinearity
    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      =    137523
    Time variable : year                            Number of groups   =     15628
    Number of instruments = 241                     Obs per group: min =         1
    Wald chi2(31) =  10157.69                                      avg =      8.80
    Prob > chi2   =     0.000                                      max =        19
    -------------------------------------------------------------------------------
                  |              Corrected
          DEP_VAR | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
    --------------+----------------------------------------------------------------
    KEY_INDEP_VAR |   .0495569   .0091046     5.44   0.000     .0317121    .0674016
                  |
             year |
            2000  |   .1391199   .0133214    10.44   0.000     .1130104    .1652294
            2002  |  -.0174214   .0079028    -2.20   0.027    -.0329106   -.0019323
            2003  |   .0243558    .006567     3.71   0.000     .0114848    .0372269
            2004  |   .0471174   .0073238     6.43   0.000      .032763    .0614718
            2005  |   .0633432   .0079008     8.02   0.000     .0478578    .0788285
            2006  |   .0587114   .0074014     7.93   0.000     .0442049    .0732178
            2007  |   .0292609   .0068337     4.28   0.000     .0158671    .0426546
            2008  |  -.0151653   .0056269    -2.70   0.007    -.0261938   -.0041368
            2009  |  -.0139271   .0048216    -2.89   0.004    -.0233774   -.0044769
            2010  |   .0033373    .004372     0.76   0.445    -.0052317    .0119062
            2011  |  -.0008633   .0046948    -0.18   0.854    -.0100649    .0083383
            2012  |    .008641   .0037336     2.31   0.021     .0013233    .0159588
            2013  |   .0130211   .0036124     3.60   0.000     .0059411    .0201012
            2014  |    .026704   .0042533     6.28   0.000     .0183677    .0350403
            2015  |   .0127859   .0038573     3.31   0.001     .0052258     .020346
            2016  |  -.0074542    .002863    -2.60   0.009    -.0130655   -.0018428
            2017  |   -.014839   .0025782    -5.76   0.000    -.0198921   -.0097858
            2019  |  -.0223558   .0033719    -6.63   0.000    -.0289645   -.0157471
                  |
          Firm_C1 |  -.0330403   .0046483    -7.11   0.000    -.0421509   -.0239298
          Firm_C2 |   .1201259   .0337599     3.56   0.000     .0539578    .1862941
          Firm_C3 |   .0348483   .0076759     4.54   0.000     .0198039    .0498928
          Firm_C4 |   .1739604   .0120762    14.41   0.000     .1502915    .1976293
          Firm_C5 |   .0145557   .0021544     6.76   0.000     .0103333    .0187782
          Firm_C6 |   -.487628   .0792169    -6.16   0.000    -.6428902   -.3323659
          Firm_C7 |    .177308   .0640902     2.77   0.006     .0516936    .3029224
          Firm_C8 |  -.1239519   .0327534    -3.78   0.000    -.1881475   -.0597564
          Firm_C9 |  -.0431818   .0037204   -11.61   0.000    -.0504736     -.03589
         Macro_C1 |   .0380888   .0062416     6.10   0.000     .0258555    .0503221
         Macro_C2 |   .0047792   .0003157    15.14   0.000     .0041605    .0053979
         Macro_C3 |  -.0016251    .000144   -11.28   0.000    -.0019074   -.0013427
            _cons |  -.1112933   .0446202    -2.49   0.013    -.1987472   -.0238394
    -------------------------------------------------------------------------------
    Instruments for first differences equation
      Standard
        D.(Macro_C1 Macro_C2 Macro_C3 1999b.year 2000.year 2001.year 2002.year
        2003.year 2004.year 2005.year 2006.year 2007.year 2008.year 2009.year
        2010.year 2011.year 2012.year 2013.year 2014.year 2015.year 2016.year
        2017.year 2018.year 2019.year)
      GMM-type (missing=0, separate instruments for each period unless collapsed)
        L(2/10).(Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9)
        collapsed
        L(1/3).Firm_C1
        L(1/3).L.DEP_VAR
    Instruments for levels equation
      Standard
        Macro_C1 Macro_C2 Macro_C3 1999b.year 2000.year 2001.year 2002.year
        2003.year 2004.year 2005.year 2006.year 2007.year 2008.year 2009.year
        2010.year 2011.year 2012.year 2013.year 2014.year 2015.year 2016.year
        2017.year 2018.year 2019.year
        _cons
      GMM-type (missing=0, separate instruments for each period unless collapsed)
        DL.(Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9)
        collapsed
        D.Firm_C1
        D.L.DEP_VAR
    ------------------------------------------------------------------------------
    Arellano-Bond test for AR(1) in first differences: z = -47.48  Pr > z =  0.000
    Arellano-Bond test for AR(2) in first differences: z =   7.26  Pr > z =  0.000
    ------------------------------------------------------------------------------
    Sargan test of overid. restrictions: chi2(209)  =2222.98  Prob > chi2 =  0.000
      (Not robust, but not weakened by many instruments.)
    Hansen test of overid. restrictions: chi2(209)  =1152.10  Prob > chi2 =  0.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(164)  = 825.91  Prob > chi2 =  0.000
        Difference (null H = exogenous): chi2(45)   = 326.18  Prob > chi2 =  0.000
      gmm(L.DEP_VAR, lag(1 3))
        Hansen test excluding group:     chi2(140)  = 849.77  Prob > chi2 =  0.000
        Difference (null H = exogenous): chi2(69)   = 302.33  Prob > chi2 =  0.000
      gmm(Firm_C1, lag(1 3))
        Hansen test excluding group:     chi2(139)  = 860.39  Prob > chi2 =  0.000
        Difference (null H = exogenous): chi2(70)   = 291.71  Prob > chi2 =  0.000
      gmm(Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9, collapse lag(2 10))
        Hansen test excluding group:     chi2(129)  = 658.80  Prob > chi2 =  0.000
        Difference (null H = exogenous): chi2(80)   = 493.29  Prob > chi2 =  0.000
      iv(Macro_C1 Macro_C2 Macro_C3 1999b.year 2000.year 2001.year 2002.year 2003.year 2004.year 2005.year 2
    > 006.year 2007.year 2008.year 2009.year 2010.year 2011.year 2012.year 2013.year 2014.year 2015.year 201
    > 6.year 2017.year 2018.year 2019.year)
        Hansen test excluding group:     chi2(188)  =1034.39  Prob > chi2 =  0.000
        Difference (null H = exogenous): chi2(21)   = 117.71  Prob > chi2 =  0.000



    Coefficient of KEY_INDEP_VAR has changed and I am unable to find a reason for this change. In one post in Stata, I got to know that there is no need of employing firm-fixed effects and
    1) Is that the case where I can assume safely in the above model firm-level fixed effects is controlled for?
    2) First part of the code should be exactly as the OLS code right, xtabond2 DEP_VAR KEY_INDEP_VA i.year Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9 Macro_C1 Macro_C2 Macro_C3 is same as xtreg DEP_VAR KEY_INDEP_VA i.year Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9 Macro_C1 Macro_C2 Macro_C3 ?
    3) Based on Roodman's reading, I think that strictly exogenous variables are only included in ivstyle. Based on my codes, I considered only year dummies (i.year) and macro level variables as strictly exogenous.
    a) Is my approach correct?
    b) Also, there are no lag options for variables in ivstyle, right?
    4) Pre-determined and endogenous variables are entered in the gmm option, right? But since both are entered in gmm only, why to make a distinction as predetermined and endogenous
    5) The lags I specified , say lag(2 10) are they arbitrary? Is it to be read as say Lags 2-10

    I am extremely sorry for asking these many doubts but I feel that somewhere I must start and hence I ran the codes and thought of posing my questions to experts here.
    I am flagging Sebastian Kripfganz because of his informative posts in this forum and if he could help me here

    Last edited by Neelakanda Krishna; 09 Jan 2023, 04:20.

  • #2
    A few remarks:
    • You have not specifically specified any instruments for KEY_INDEP_VAR. It is very likely that the utilized instruments are quite weak.
    • Note that specifying iv(varlist) without the equation() suboption is not the same as specifying jointly iv(varlist, eq(diff)) iv(varlist, eq(level)). Most people have the latter in mind when specifying the model; thus, I recommend to always explicitly specify the equation.
    • By specifying iv(Macro_C1 Macro_C2 Macro_C3), you are creating untransformed instruments from those variables for the level model. It is quite likely that those instruments are invalid if these variables are correlated with the unobserved group-specific effects (aka "fixed effects").
    • In essence, iv() is a collapsed version of gmm() with particular choices for lags and variable transformations. If you get confused with iv(), just specify all instruments with gmm() and make appropriate use of the lag(), passthru, and collapse suboptions. The lag() suboption determines whether you treat a variable as strictly exogenous, predetermined, or endogenous, depending on whether your first lag is 0, 1, or 2 for the first-differenced model.
    • More on dynamic panel data GMM estimation in Stata:
    https://www.kripfganz.de/stata/

    Comment


    • #3
      Dear Sebastian Kripfganz
      Thanks for taking the time and effort to help me with your valuable suggestions. As I mentioned, I don't have any background in dynamic panels, and hence I carefully read a few answers of you in this forum.

      You have not specifically specified any instruments for KEY_INDEP_VAR. It is very likely that the utilized instruments are quite weak.
      How do I do this? Also in which part I should keep those instruments-gmm or ivstyle

      Note that specifying iv(varlist) without the equation() suboption is not the same as specifying jointly iv(varlist, eq(diff)) iv(varlist, eq(level)). Most people have the latter in mind when specifying the model; thus, I recommend to always explicitly specify the equation.
      After reading your posts, I realized that you have been asserting this strongly, and thanks for this, even though I am clueless whether I should use eq(level) of eq(diff) under IV style in my case

      By specifying iv(Macro_C1 Macro_C2 Macro_C3), you are creating untransformed instruments from those variables for the level model. It is quite likely that those instruments are invalid if these variables are correlated with the unobserved group-specific effects (aka "fixed effects").
      Dear Sir, here I have a doubt, what is level model here? Is that the first part of gmm command that starts from xtabond2 to ,gmm? Also, how to transform instruments here? Is that what you mean by eq(diff)? So if I just say
      Code:
      iv(Macro_C1 Macro_C2 Macro_C3 i.year)
      does this mean , untransformed as it is in level

      Code:
       If you get confused with iv(), just specify all instruments with gmm() and make appropriate use of the lag(), passthru, and collapse suboptions. The lag() suboption determines whether you treat a variable as strictly exogenous, predetermined, or endogenous, depending on whether your first lag is 0, 1, or 2 for the first-differenced model.
      Sir, as you pointed I am not sure whether my Macro Vars (C1 to C3) are truly exogenous and how in my case write a command to consider all the instruments like gmm only.

      After reading your posts, I tried the following.

      .
      Code:
       xtabond2 DEP_VAR L.DEP_VAR KEY_INDEP_VA i.year  Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9 Macro_C1 Macro_C2 Macro_C3, gmm (Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9, equation (diff) lag (2 5) collapse) gmm (Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9, equation (level)lag (1 1) collapse) iv( KEY_INDEP_VA Macro_C1 Macro_C2 Macro_C3 i.year, equation(level))iv( KEY_INDEP_VA Macro_C1 Macro_C2 Macro_C3 i.year, equation(level)) twostep robust
      Favoring space over speed. To switch, type or click on mata: mata set matafavor speed, perm.
      1999b.year dropped due to collinearity
      2001.year dropped due to collinearity
      2018.year dropped due to collinearity
      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      =    122459
      Time variable : year                            Number of groups   =     14848
      Number of instruments = 68                      Obs per group: min =         1
      Wald chi2(32) =   6855.34                                      avg =      8.25
      Prob > chi2   =     0.000                                      max =        19
      -------------------------------------------------------------------------------
                    |              Corrected
            DEP_VAR | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
      --------------+----------------------------------------------------------------
            DEP_VAR |
                L1. |   -.104185   .0189766    -5.49   0.000    -.1413784   -.0669915
                    |
      KEY_INDEP_VAR |   .0268082   .0049504     5.42   0.000     .0171056    .0365109
                    |
               year |
              2000  |   .1641844   .0146956    11.17   0.000     .1353815    .1929872
              2002  |  -.0498013   .0085166    -5.85   0.000    -.0664936   -.0331091
              2003  |    .023196   .0082392     2.82   0.005     .0070476    .0393445
              2004  |    .046206   .0078886     5.86   0.000     .0307446    .0616673
              2005  |   .0454059   .0066531     6.82   0.000     .0323661    .0584456
              2006  |    .050813   .0062323     8.15   0.000      .038598     .063028
              2007  |   .0194342   .0064877     3.00   0.003     .0067186    .0321498
              2008  |  -.0154781    .007919    -1.95   0.051     -.030999    .0000428
              2009  |  -.0439856   .0063047    -6.98   0.000    -.0563425   -.0316287
              2010  |   .0103193   .0056503     1.83   0.068    -.0007551    .0213937
              2011  |   .0131706   .0066726     1.97   0.048     .0000926    .0262487
              2012  |   .0048993     .00456     1.07   0.283    -.0040381    .0138368
              2013  |   .0023102   .0041323     0.56   0.576    -.0057889    .0104093
              2014  |    .013027   .0041608     3.13   0.002     .0048719    .0211821
              2015  |  -.0054152   .0057508    -0.94   0.346    -.0166865    .0058561
              2016  |  -.0170692   .0036862    -4.63   0.000    -.0242941   -.0098443
              2017  |   -.013056   .0032145    -4.06   0.000    -.0193564   -.0067556
              2019  |  -.0262061   .0032746    -8.00   0.000    -.0326243    -.019788
                    |
            Firm_C1 |  -.0679932   .0064625   -10.52   0.000    -.0806594   -.0553271
            Firm_C2 |   .3416254   .0403486     8.47   0.000     .2625435    .4207072
            Firm_C3 |   .0321911    .008699     3.70   0.000     .0151414    .0492407
            Firm_C4 |   .0866626   .0350766     2.47   0.013     .0179137    .1554115
            Firm_C5 |   .0177264   .0029365     6.04   0.000     .0119709    .0234819
            Firm_C6 |  -.0670552   .1152601    -0.58   0.561    -.2929609    .1588504
            Firm_C7 |    .167464    .063673     2.63   0.009     .0426672    .2922609
            Firm_C8 |  -.1028602   .0344703    -2.98   0.003    -.1704208   -.0352997
            Firm_C9 |  -.0275271   .0041953    -6.56   0.000    -.0357497   -.0193045
           Macro_C1 |   .0868119   .0075003    11.57   0.000     .0721116    .1015122
           Macro_C2 |   .0039334   .0004207     9.35   0.000     .0031088     .004758
           Macro_C3 |  -.0028517   .0001814   -15.72   0.000    -.0032073   -.0024962
              _cons |  -.1515865   .0484762    -3.13   0.002    -.2465981   -.0565748
      -------------------------------------------------------------------------------
      Instruments for first differences equation
        GMM-type (missing=0, separate instruments for each period unless collapsed)
          L(2/5).(Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8
          Firm_C9) collapsed
      Instruments for levels equation
        Standard
          KEY_INDEP_VAR Macro_C1 Macro_C2 Macro_C3 1999b.year 2000.year 2001.year
          2002.year 2003.year 2004.year 2005.year 2006.year 2007.year 2008.year
          2009.year 2010.year 2011.year 2012.year 2013.year 2014.year 2015.year
          2016.year 2017.year 2018.year 2019.year
          KEY_INDEP_VAR Macro_C1 Macro_C2 Macro_C3 1999b.year 2000.year 2001.year
          2002.year 2003.year 2004.year 2005.year 2006.year 2007.year 2008.year
          2009.year 2010.year 2011.year 2012.year 2013.year 2014.year 2015.year
          2016.year 2017.year 2018.year 2019.year
          _cons
        GMM-type (missing=0, separate instruments for each period unless collapsed)
          DL.(Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8
          Firm_C9) collapsed
      ------------------------------------------------------------------------------
      Arellano-Bond test for AR(1) in first differences: z = -22.00  Pr > z =  0.000
      Arellano-Bond test for AR(2) in first differences: z =   0.22  Pr > z =  0.823
      ------------------------------------------------------------------------------
      Sargan test of overid. restrictions: chi2(35)   = 557.48  Prob > chi2 =  0.000
        (Not robust, but not weakened by many instruments.)
      Hansen test of overid. restrictions: chi2(35)   = 315.55  Prob > chi2 =  0.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(26)   = 152.53  Prob > chi2 =  0.000
          Difference (null H = exogenous): chi2(9)    = 163.02  Prob > chi2 =  0.000
        gmm(Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9, collapse eq(level) lag(1
      > 1))
          Hansen test excluding group:     chi2(26)   = 152.53  Prob > chi2 =  0.000
          Difference (null H = exogenous): chi2(9)    = 163.02  Prob > chi2 =  0.000
        iv(KEY_INDEP_VAR Macro_C1 Macro_C2 Macro_C3 1999b.year 2000.year 2001.year 2002.year 2003.year 2004.ye
      > ar 2005.year 2006.year 2007.year 2008.year 2009.year 2010.year 2011.year 2012.year 2013.year 2014.year
      >  2015.year 2016.year 2017.year 2018.year 2019.year, eq(level))
          Hansen test excluding group:     chi2(29)   = 315.55  Prob > chi2 =  0.000
          Difference (null H = exogenous): chi2(6)    =  -0.00  Prob > chi2 =  1.000
        iv(KEY_INDEP_VAR Macro_C1 Macro_C2 Macro_C3 1999b.year 2000.year 2001.year 2002.year 2003.year 2004.ye
      > ar 2005.year 2006.year 2007.year 2008.year 2009.year 2010.year 2011.year 2012.year 2013.year 2014.year
      >  2015.year 2016.year 2017.year 2018.year 2019.year, eq(level))
          Hansen test excluding group:     chi2(19)   = 315.55  Prob > chi2 =  0.000
          Difference (null H = exogenous): chi2(16)   =  -0.00  Prob > chi2 =  1.000


      Please help me in writing correct model specification!

      I also tried fixed effects with industry but still I am not sure what is happening

      Code:
      xtabond2 DEP_VAR L.DEP_VAR KEY_INDEP_VA i.year i.ind_dum  Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm
      > _C6 Firm_C7 Firm_C8 Firm_C9 Macro_C1 Macro_C2 Macro_C3, ///
      > gmm (Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9 KEY_INDEP_VA Macro_C1 Mac
      > ro_C2 Macro_C3 i.year, equation (diff) lag (2 2) collapse) ///
      > gmm ( Macro_C1 Macro_C2 Macro_C3 i.year, equation (level)lag (5 3) collapse) ///
      > iv(i.year, equation(level)) ///
      > iv(i.year, equation(diff)) twostep robust                       
      Favoring space over speed. To switch, type or click on mata: mata set matafavor speed, perm.
      1999b.year dropped due to collinearity
      2001.year dropped due to collinearity
      2018.year dropped due to collinearity
      11b.ind_dum dropped due to collinearity
      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      =    122459
      Time variable : year                            Number of groups   =     14848
      Number of instruments = 106                     Obs per group: min =         1
      Wald chi2(49) =   2329.66                                      avg =      8.25
      Prob > chi2   =     0.000                                      max =        19
      -------------------------------------------------------------------------------
                    |              Corrected
            DEP_VAR | Coefficient  std. err.      z    P>|z|     [95% conf. interval]
      --------------+----------------------------------------------------------------
            DEP_VAR |
                L1. |   .0151197   .0551568     0.27   0.784    -.0929856    .1232251
                    |
      KEY_INDEP_VAR |    .066368   .0121075     5.48   0.000     .0426378    .0900983
                    |
               year |
              2000  |   .0498374   .0475236     1.05   0.294    -.0433072    .1429821
              2002  |  -.0311168   .0178917    -1.74   0.082    -.0661839    .0039504
              2003  |   .0300988   .0173125     1.74   0.082    -.0038332    .0640308
              2004  |   .0659854   .0173017     3.81   0.000     .0320747     .099896
              2005  |   .0794902   .0165924     4.79   0.000     .0469698    .1120107
              2006  |   .0804122   .0168818     4.76   0.000     .0473244       .1135
              2007  |   .0478981   .0146912     3.26   0.001     .0191038    .0766924
              2008  |   .0020883   .0149021     0.14   0.889    -.0271193    .0312959
              2009  |  -.0322364   .0107071    -3.01   0.003    -.0532219   -.0112509
              2010  |   .0189726   .0115219     1.65   0.100    -.0036098    .0415551
              2011  |   .0132148   .0136202     0.97   0.332    -.0134803    .0399099
              2012  |   .0138651   .0103369     1.34   0.180    -.0063947     .034125
              2013  |   .0152927   .0070435     2.17   0.030     .0014877    .0290976
              2014  |   .0281503   .0072096     3.90   0.000     .0140198    .0422808
              2015  |   .0032605   .0085141     0.38   0.702    -.0134269    .0199479
              2016  |  -.0180868   .0043539    -4.15   0.000    -.0266203   -.0095533
              2017  |  -.0218251   .0041139    -5.31   0.000    -.0298883   -.0137619
              2019  |  -.0301562   .0048554    -6.21   0.000    -.0396727   -.0206397
                    |
            ind_dum |
                21  |    .289659   .9653172     0.30   0.764    -1.602328    2.181646
                23  |   1.030255   1.011438     1.02   0.308    -.9521279    3.012638
                31  |   .8554457   .9560176     0.89   0.371    -1.018314    2.729206
                42  |    1.04226   .9576759     1.09   0.276    -.8347504     2.91927
                44  |   .6536212   1.016978     0.64   0.520    -1.339619    2.646862
                48  |   1.417445   1.154153     1.23   0.219    -.8446535    3.679544
                51  |   1.016948   1.016597     1.00   0.317    -.9755454    3.009441
                53  |   1.643492   .9986558     1.65   0.100    -.3138372    3.600822
                54  |   .1470274   .9536453     0.15   0.877    -1.722083    2.016138
                55  |   -.047884   9.897546    -0.00   0.996    -19.44672    19.35095
                56  |   4.389298   1.683159     2.61   0.009     1.090367    7.688228
                61  |  -.6217782   1.400469    -0.44   0.657    -3.366647    2.123091
                62  |   2.853389   1.674348     1.70   0.088    -.4282733    6.135051
                71  |   .1453018     1.2815     0.11   0.910    -2.366392    2.656996
                72  |  -.8604343   1.010927    -0.85   0.395    -2.841815    1.120946
                81  |   2.772454   1.605546     1.73   0.084    -.3743594    5.919267
                92  |   -17.6489   18.69807    -0.94   0.345    -54.29645    18.99865
                    |
            Firm_C1 |   .0056382   .0166944     0.34   0.736    -.0270822    .0383586
            Firm_C2 |   .1083968   .0686962     1.58   0.115    -.0262453    .2430389
            Firm_C3 |   .0942959   .0167367     5.63   0.000     .0614926    .1270992
            Firm_C4 |   .1520129   .0425215     3.57   0.000     .0686723    .2353535
            Firm_C5 |   .0280519   .0063696     4.40   0.000     .0155677    .0405361
            Firm_C6 |  -1.029106   .3002233    -3.43   0.001    -1.617533   -.4406792
            Firm_C7 |   .3513684   .0868824     4.04   0.000      .181082    .5216549
            Firm_C8 |   -.049233   .0866028    -0.57   0.570    -.2189714    .1205054
            Firm_C9 |  -.0605283   .0204403    -2.96   0.003    -.1005904   -.0204661
           Macro_C1 |   -.033437   .0237602    -1.41   0.159    -.0800062    .0131321
           Macro_C2 |   .0055564   .0011248     4.94   0.000     .0033519    .0077609
           Macro_C3 |   -.000939   .0007081    -1.33   0.185    -.0023269     .000449
              _cons |  -.7485615   .9962299    -0.75   0.452    -2.701136    1.204013
      -------------------------------------------------------------------------------
      Instruments for first differences equation
        Standard
          D.(1999b.year 2000.year 2001.year 2002.year 2003.year 2004.year 2005.year
          2006.year 2007.year 2008.year 2009.year 2010.year 2011.year 2012.year
          2013.year 2014.year 2015.year 2016.year 2017.year 2018.year 2019.year)
        GMM-type (missing=0, separate instruments for each period unless collapsed)
          L2.(Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8
          Firm_C9 KEY_INDEP_VAR Macro_C1 Macro_C2 Macro_C3 1999b.year 2000.year
          2001.year 2002.year 2003.year 2004.year 2005.year 2006.year 2007.year
          2008.year 2009.year 2010.year 2011.year 2012.year 2013.year 2014.year
          2015.year 2016.year 2017.year 2018.year 2019.year) collapsed
      Instruments for levels equation
        Standard
          1999b.year 2000.year 2001.year 2002.year 2003.year 2004.year 2005.year
          2006.year 2007.year 2008.year 2009.year 2010.year 2011.year 2012.year
          2013.year 2014.year 2015.year 2016.year 2017.year 2018.year 2019.year
          _cons
        GMM-type (missing=0, separate instruments for each period unless collapsed)
          DL(3/5).(Macro_C1 Macro_C2 Macro_C3 1999b.year 2000.year 2001.year
          2002.year 2003.year 2004.year 2005.year 2006.year 2007.year 2008.year
          2009.year 2010.year 2011.year 2012.year 2013.year 2014.year 2015.year
          2016.year 2017.year 2018.year 2019.year) collapsed
      ------------------------------------------------------------------------------
      Arellano-Bond test for AR(1) in first differences: z =  -9.56  Pr > z =  0.000
      Arellano-Bond test for AR(2) in first differences: z =   2.19  Pr > z =  0.029
      ------------------------------------------------------------------------------
      Sargan test of overid. restrictions: chi2(56)   =1113.84  Prob > chi2 =  0.000
        (Not robust, but not weakened by many instruments.)
      Hansen test of overid. restrictions: chi2(56)   = 402.14  Prob > chi2 =  0.000
        (Robust, but weakened by many instruments.)
      
      Difference-in-Hansen tests of exogeneity of instrument subsets:
        gmm(Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9 KEY_INDEP_VAR Macro_C1 Mac
      > ro_C2 Macro_C3 1999b.year 2000.year 2001.year 2002.year 2003.year 2004.year 2005.year 2006.year 2007.y
      > ear 2008.year 2009.year 2010.year 2011.year 2012.year 2013.year 2014.year 2015.year 2016.year 2017.yea
      > r 2018.year 2019.year, collapse eq(diff) lag(2 2))
          Hansen test excluding group:     chi2(42)   =  94.04  Prob > chi2 =  0.000
          Difference (null H = exogenous): chi2(14)   = 308.10  Prob > chi2 =  0.000
        iv(1999b.year 2000.year 2001.year 2002.year 2003.year 2004.year 2005.year 2006.year 2007.year 2008.yea
      > r 2009.year 2010.year 2011.year 2012.year 2013.year 2014.year 2015.year 2016.year 2017.year 2018.year 
      > 2019.year, eq(level))
          Hansen test excluding group:     chi2(38)   = 346.87  Prob > chi2 =  0.000
          Difference (null H = exogenous): chi2(18)   =  55.27  Prob > chi2 =  0.000
        iv(1999b.year 2000.year 2001.year 2002.year 2003.year 2004.year 2005.year 2006.year 2007.year 2008.yea
      > r 2009.year 2010.year 2011.year 2012.year 2013.year 2014.year 2015.year 2016.year 2017.year 2018.year 
      > 2019.year, eq(diff))
          Hansen test excluding group:     chi2(40)   = 402.14  Prob > chi2 =  0.000
          Difference (null H = exogenous): chi2(16)   =  -0.00  Prob > chi2 =  1.000
      Last edited by Neelakanda Krishna; 10 Jan 2023, 09:16.

      Comment

      Working...
      X