Hello everyone,

I have an issue regarding xtabond2 and Hansen statistics and I was wondering if anyone could help me with that.

Here is my code and what Stata provides:

Code:
 xtabond2 winv2 wndf wdiv2 wcf  wmtb wtang cage wsalesg wsize l.stdev  l.winv2   y4-y32, gmmstyle(l.winv2 wndf 
> wdiv2, lag(2 5) collapse) iv( wmtb   wcf wtang l.stdev cage wsalesg wsize y4-y32, eq(level)) iv(wmtb   wcf wta
> ng l.stdev cage wsalesg wsize, eq(diff)) twostep small robust
Favoring space over speed. To switch, type or click on mata: mata set matafavor speed, perm.

Dynamic panel-data estimation, two-step system GMM
------------------------------------------------------------------------------
Group variable: companyno                       Number of obs      =      4925
Time variable : datayearfi~l                    Number of groups   =       463
Number of instruments = 59                      Obs per group: min =         1
F(39, 462)    =     14.51                                      avg =     10.64
Prob > F      =     0.000                                      max =        30
------------------------------------------------------------------------------
             |              Corrected
       winv2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        wndf |   .5197724   .0736962     7.05   0.000     .3749511    .6645937
       wdiv2 |  -.0761525   .0361605    -2.11   0.036    -.1472119    -.005093
         wcf |   .1376568   .0394813     3.49   0.001     .0600716     .215242
        wmtb |   .0065393   .0032135     2.03   0.042     .0002244    .0128543
       wtang |    .031711   .0093283     3.40   0.001     .0133798    .0500421
        cage |  -.0117218   .0047613    -2.46   0.014    -.0210783   -.0023652
     wsalesg |   .0277694    .010588     2.62   0.009     .0069628     .048576
       wsize |   .0029869   .0013757     2.17   0.030     .0002836    .0056903
             |
       stdev |
         L1. |  -.1754014   .1576928    -1.11   0.267    -.4852853    .1344825
             |
       winv2 |
         L1. |   .1345404   .0392788     3.43   0.001     .0573531    .2117277
             |
          y4 |  -.0670014   .0490034    -1.37   0.172    -.1632986    .0292958
          y5 |  -.0764702   .0436855    -1.75   0.081    -.1623172    .0093768
          y6 |  -.0466703    .043778    -1.07   0.287     -.132699    .0393584
          y7 |  -.0535834    .039934    -1.34   0.180    -.1320582    .0248914
          y8 |  -.0046665   .0448924    -0.10   0.917    -.0928851     .083552
          y9 |  -.0310349   .0449769    -0.69   0.491    -.1194196    .0573498
         y10 |  -.0266905   .0421176    -0.63   0.527    -.1094563    .0560752
         y11 |   -.047943   .0454478    -1.05   0.292     -.137253     .041367
         y12 |  -.0457779   .0416776    -1.10   0.273     -.127679    .0361233
         y13 |  -.0440037   .0414834    -1.06   0.289    -.1255232    .0375157
         y14 |  -.0183853   .0432421    -0.43   0.671    -.1033609    .0665902
         y15 |  -.0394861   .0432887    -0.91   0.362    -.1245532    .0455809
         y16 |  -.0272495   .0436253    -0.62   0.533    -.1129781     .058479
         y17 |  -.0428482   .0433147    -0.99   0.323    -.1279664      .04227
         y18 |  -.0159717   .0433348    -0.37   0.713    -.1011294    .0691861
         y19 |  -.0042772   .0432104    -0.10   0.921    -.0891906    .0806361
         y20 |  -.0204746   .0426472    -0.48   0.631    -.1042811    .0633319
         y21 |  -.0016345    .043723    -0.04   0.970     -.087555    .0842861
         y22 |  -.0181546    .042542    -0.43   0.670    -.1017543    .0654451
         y23 |  -.0264723   .0429187    -0.62   0.538    -.1108123    .0578677
         y24 |  -.0299797   .0425649    -0.70   0.482    -.1136245    .0536651
         y25 |  -.0318005   .0421004    -0.76   0.450    -.1145325    .0509314
         y26 |  -.0389249   .0422431    -0.92   0.357    -.1219373    .0440875
         y27 |  -.0237457   .0427874    -0.55   0.579    -.1078278    .0603365
         y28 |    -.02853    .042558    -0.67   0.503    -.1121612    .0551012
         y29 |  -.0178813   .0427483    -0.42   0.676    -.1018865    .0661239
         y30 |  -.0284094   .0426339    -0.67   0.506    -.1121898     .055371
         y31 |  -.0375211   .0422606    -0.89   0.375     -.120568    .0455257
         y32 |  -.0400235   .0424093    -0.94   0.346    -.1233625    .0433156
       _cons |   .0029791   .0440888     0.07   0.946    -.0836603    .0896185
------------------------------------------------------------------------------
Instruments for first differences equation
  Standard
    D.(wmtb wcf wtang L.stdev cage wsalesg wsize)
  GMM-type (missing=0, separate instruments for each period unless collapsed)
    L(2/5).(L.winv2 wndf wdiv2) collapsed
Instruments for levels equation
  Standard
    _cons
    wmtb wcf wtang L.stdev cage wsalesg wsize y4 y5 y6 y7 y8 y9 y10 y11 y12
    y13 y14 y15 y16 y17 y18 y19 y20 y21 y22 y23 y24 y25 y26 y27 y28 y29 y30
    y31 y32
  GMM-type (missing=0, separate instruments for each period unless collapsed)
    DL.(L.winv2 wndf wdiv2) collapsed
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z =  -6.77  Pr > z =  0.000
Arellano-Bond test for AR(2) in first differences: z =   0.84  Pr > z =  0.400
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(19)   = 110.06  Prob > chi2 =  0.000
  (Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(19)   =  32.49  Prob > chi2 =  0.027
  (Robust, but can be weakened by many instruments.)

Difference-in-Hansen tests of exogeneity of instrument subsets:
  GMM instruments for levels
    Hansen test excluding group:     chi2(16)   =  30.31  Prob > chi2 =  0.016
    Difference (null H = exogenous): chi2(3)    =   2.18  Prob > chi2 =  0.536
  gmm(L.winv2 wndf wdiv2, collapse lag(2 5))
    Hansen test excluding group:     chi2(4)    =  17.36  Prob > chi2 =  0.002
    Difference (null H = exogenous): chi2(15)   =  15.14  Prob > chi2 =  0.442
  iv(wmtb wcf wtang L.stdev cage wsalesg wsize, eq(diff))
    Hansen test excluding group:     chi2(12)   =  14.38  Prob > chi2 =  0.277
    Difference (null H = exogenous): chi2(7)    =  18.12  Prob > chi2 =  0.011

.
Lagged dependent variable, L.winv2, and two other regressors, wdiv2 and wndf, are endogenous variables. I treat the rest as exogenous. As you can see the Hansen test of overid. restrictions comes out highly significant, which is a problem I assume. Given that AR(2) is insignificant, what could cause this and what would a possible solution be? Is there an issue with the code? I am pretty new to xtabond2 and I would appreciate every comment on this.

Many thanks.