Hello everyone,

I am trying to work out how to complete a DiD analysis with Difference GMM and System GMM (xtabond and xtdpdsys) using Panel Data.

My data set contains 8,232 students in a Panel Data format with T=5. For each student, I have the test scores (depvar) and a list of observed variables over the time period (indepvar).

During the time series (2003-2008), a policy change is implemented in state schools in year 2007. Then, students from state schools are my treatment group and students from municipal schools are the control group. My DiD is 1 if student is enrolled in state school (treated) in post-treatment period (time).


FIRST QUESTION.

I include a lagged variable in the model with the test score of the student i in t-1. Then I need to fit the DiD in xtabond, xtdpd and xtdpdsys.

My first attempt was:

Code:
.
xtdpd profic_mat L.profic_mat DiD time treated $ControlVar, div($ControlVar) dgmmiv(profic_mat)

Dynamic panel-data estimation                Number of obs         =      9882
Group variable: IDaluno                      Number of groups      =      4513
Time variable: wave
                                             Obs per group:    min =         1
                                                               avg =  2.189674
                                                               max =         4

Number of instruments =     14               Wald chi2(11)         =    617.96
                                             Prob > chi2           =    0.0000
One-step results
------------------------------------------------------------------------------
  profic_mat |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  profic_mat |
         L1. |   1.647524   .1168507    14.10   0.000     1.418501    1.876547
             |
         DiD |   430.7909   228.7262     1.88   0.060    -17.50425    879.0861
        time |  -222.3807   108.4029    -2.05   0.040    -434.8464   -9.915043
     treated |  -562.5099   1232.334    -0.46   0.648    -2977.841    1852.821
        q111 |   -68.1603   29.99675    -2.27   0.023    -126.9529   -9.367746
  educaTeach |  -8.906975   8.316335    -1.07   0.284    -25.20669    7.392742
        q110 |  -5.890573   2.960751    -1.99   0.047    -11.69354    -.087607
        q108 |   4.331367   3.963205     1.09   0.274    -3.436371    12.09911
        q106 |   1.783682   2.607462     0.68   0.494     -3.32685    6.894214
        q105 |  -9.611421   4.845548    -1.98   0.047    -19.10852    -.114321
        q104 |  -14.47452   4.744586    -3.05   0.002    -23.77374   -5.175307
       _cons |   453.0812   713.6051     0.63   0.525    -945.5591    1851.722
------------------------------------------------------------------------------
Instruments for differenced equation
        GMM-type: L(2/.).profic_mat
        Standard: D.q111 D.educaTeach D.q110 D.q108 D.q106 D.q105 D.q104
Instruments for level equation
        Standard: _cons

My second try was:

Code:
.
xtdpd profic_mat L.profic_mat DiD time treated $ControlVar, div(DiD time treated $ControlVar) dgmmiv(profic_mat)

Dynamic panel-data estimation                Number of obs         =      9882
Group variable: IDaluno                      Number of groups      =      4513
Time variable: wave
                                             Obs per group:    min =         1
                                                               avg =  2.189674
                                                               max =         4

Number of instruments =     17               Wald chi2(11)         =   2530.95
                                             Prob > chi2           =    0.0000
One-step results
------------------------------------------------------------------------------
  profic_mat |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
  profic_mat |
         L1. |   1.531564   .0536515    28.55   0.000     1.426409    1.636718
             |
         DiD |  -3.456692   3.764445    -0.92   0.358    -10.83487    3.921484
        time |  -15.46012   3.739152    -4.13   0.000    -22.78873   -8.131519
     treated |  -7.031441   16.22298    -0.43   0.665     -38.8279    24.76502
        q111 |  -6.463428   5.720106    -1.13   0.258    -17.67463    4.747773
  educaTeach |   1.322595   2.059962     0.64   0.521    -2.714857    5.360048
        q110 |  -2.258975   .8237047    -2.74   0.006    -3.873406   -.6445432
        q108 |  -.8757389   1.042708    -0.84   0.401    -2.919409    1.167931
        q106 |   1.828283   .9248911     1.98   0.048     .0155295    3.641036
        q105 |  -3.568163   1.739991    -2.05   0.040    -6.978484   -.1578426
        q104 |  -7.057929   1.010115    -6.99   0.000    -9.037717    -5.07814
       _cons |   4.549558   18.15347     0.25   0.802    -31.03059    40.12971
------------------------------------------------------------------------------
Instruments for differenced equation
        GMM-type: L(2/.).profic_mat
        Standard: D.DiD D.time D.treated D.q111 D.educaTeach D.q110 D.q108 D.q106 D.q105 D.q104
Instruments for level equation
        Standard: _cons

But I am not sure, whether the DiD in this case will work exactly in the same way as in a linear model. I need help with the implentation of DiD in this GMM and with the Interpretation of its coefficient.




SECOND QUESTION:

I assume that the schools are able to select the students based on their previous scores. In a linear model, I would include a school fixed effect in the model such as:

Code:
xtreg profic_mat DiD time treated i.IDescola $controlVar, fe robust
However, when I include the school fixed effect in the GMM, the estimation of xtabond will omit automatically some schools, and consequently, I will not be able to estimate the Sargar and Arellano-Bond Tests.
Is there someone who can help me with the inclusion of this school fixed effect using xtabond, xtdpd or xtdpdsys?

Code:
xi: xtabond profic_mat i.IDescola $controlVar
i.IDescola        _IIDescola_35018107-35924957(naturally coded; _IIDescola_35018107 omitted)
note: _IIDescola_35018348 dropped from div() because of collinearity
note: _IIDescola_35042648 dropped from div() because of collinearity
note: _IIDescola_35047193 dropped from div() because of collinearity
note: _IIDescola_35083823 dropped from div() because of collinearity
note: _IIDescola_35091455 dropped from div() because of collinearity
note: _IIDescola_35121009 dropped from div() because of collinearity
note: _IIDescola_35802062 dropped from div() because of collinearity
note: _IIDescola_35909397 dropped from div() because of collinearity

Arellano-Bond dynamic panel-data estimation  Number of obs         =      8688
Group variable: IDaluno                      Number of groups      =      3948
Time variable: wave
                                             Obs per group:    min =         1
                                                               avg =  2.200608
                                                               max =         3

Number of instruments =     51               Wald chi2(45)         =   7598.99
                                             Prob > chi2           =    0.0000
One-step results
-------------------------------------------------------------------------------------
         profic_mat |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
--------------------+----------------------------------------------------------------
         profic_mat |
                L1. |   1.258465    .014629    86.03   0.000     1.229793    1.287137
                    |
_IIDescola_35018348 |          0  (omitted)
_IIDescola_35018387 |  -146.5501   125.1708    -1.17   0.242    -391.8803    98.78011
_IIDescola_35018399 |  -56.21933   138.8311    -0.40   0.686    -328.3232    215.8845
_IIDescola_35018485 |          0  (omitted)
_IIDescola_35018512 |  -56.97495   128.5957    -0.44   0.658    -309.0179     195.068
_IIDescola_35018824 |  -4.880865   131.7323    -0.04   0.970    -263.0715    253.3097
_IIDescola_35042648 |          0  (omitted)
_IIDescola_35047193 |          0  (omitted)
_IIDescola_35059122 |  -10.78363   152.7991    -0.07   0.944    -310.2644    288.6971
_IIDescola_35059158 |  -109.8035   132.0008    -0.83   0.405    -368.5204    148.9133
_IIDescola_35059161 |   13.41882   138.4068     0.10   0.923    -257.8536    284.6912
_IIDescola_35059171 |  -32.64202   135.8725    -0.24   0.810    -298.9473    233.6633
_IIDescola_35059213 |  -76.52402   123.3575    -0.62   0.535    -318.3003    165.2523
_IIDescola_35059225 |  -59.65258   134.0156    -0.45   0.656    -322.3183    203.0131
_IIDescola_35059237 |  -80.45224   138.1547    -0.58   0.560    -351.2306    190.3261
_IIDescola_35071122 |          0  (omitted)
_IIDescola_35083811 |  -32.95767   137.9087    -0.24   0.811    -303.2538    237.3385
_IIDescola_35083823 |          0  (omitted)
_IIDescola_35083847 |  -52.87668   132.9422    -0.40   0.691    -313.4387    207.6853
_IIDescola_35083859 |   177.9229   90.17332     1.97   0.048     1.186421    354.6593
_IIDescola_35083860 |  -53.44163   149.6163    -0.36   0.721    -346.6841    239.8009
_IIDescola_35084153 |  -169.6971   140.5855    -1.21   0.227    -445.2397    105.8455
_IIDescola_35086236 |  -45.69124   142.6483    -0.32   0.749    -325.2768    233.8943
_IIDescola_35088614 |  -136.5818   138.9607    -0.98   0.326    -408.9398    135.7762
_IIDescola_35088648 |  -120.5696   150.5347    -0.80   0.423    -415.6123     174.473
_IIDescola_35088675 |          0  (omitted)
_IIDescola_35088705 |      -95.6   63.77123    -1.50   0.134    -220.5893    29.38931
_IIDescola_35091455 |          0  (omitted)
_IIDescola_35112513 |  -80.03572   90.17316    -0.89   0.375    -256.7719    96.70043
_IIDescola_35112641 |  -5.148722   138.8601    -0.04   0.970    -277.3095    267.0121
_IIDescola_35112859 |          0  (omitted)
_IIDescola_35112872 |  -89.89423    120.794    -0.74   0.457    -326.6462    146.8577
_IIDescola_35121009 |          0  (omitted)
_IIDescola_35123067 |  -183.3962   127.9934    -1.43   0.152    -434.2587     67.4662
_IIDescola_35123080 |  -72.52996   121.0912    -0.60   0.549    -309.8644    164.8045
_IIDescola_35126846 |  -173.7891   137.0818    -1.27   0.205    -442.4644     94.8863
_IIDescola_35131994 |  -68.76753   124.6852    -0.55   0.581    -313.1461     175.611
_IIDescola_35132263 |  -78.41009   110.4183    -0.71   0.478    -294.8261    138.0059
_IIDescola_35138769 |  -118.0649   152.9151    -0.77   0.440     -417.773    181.6432
_IIDescola_35140636 |  -130.9619    165.691    -0.79   0.429    -455.7104    193.7865
_IIDescola_35156590 |  -99.10153   122.5745    -0.81   0.419    -339.3431      141.14
_IIDescola_35159955 |   16.42608   140.0503     0.12   0.907    -258.0675    290.9197
_IIDescola_35162024 |  -40.49048   138.9536    -0.29   0.771    -312.8346    231.8536
_IIDescola_35172467 |  -25.56766   63.76831    -0.40   0.688    -150.5513    99.41592
_IIDescola_35172510 |  -109.1299   123.4419    -0.88   0.377    -351.0716    132.8118
_IIDescola_35172716 |          0  (omitted)
_IIDescola_35185103 |          0  (omitted)
_IIDescola_35283685 |  -32.08828   135.2679    -0.24   0.812    -297.2086     233.032
_IIDescola_35802062 |          0  (omitted)
_IIDescola_35901124 |  -55.04499   135.3391    -0.41   0.684    -320.3048    210.2149
_IIDescola_35901143 |          0  (omitted)
_IIDescola_35903917 |  -94.51909   129.5968    -0.73   0.466    -348.5242    159.4861
_IIDescola_35905446 |  -112.2985   128.4339    -0.87   0.382    -364.0244    139.4274
_IIDescola_35907397 |   -88.9827   137.7691    -0.65   0.518    -359.0052    181.0398
_IIDescola_35909397 |          0  (omitted)
_IIDescola_35913005 |   38.66991   138.4898     0.28   0.780    -232.7652     310.105
_IIDescola_35913923 |          0  (omitted)
_IIDescola_35914885 |  -173.8479   137.4867    -1.26   0.206    -443.3169    95.62119
_IIDescola_35924945 |  -107.2916   136.3635    -0.79   0.431    -374.5591    159.9758
_IIDescola_35924957 |   -1.89335   63.76368    -0.03   0.976    -126.8679    123.0812
              _cons |    48.8823    87.6766     0.56   0.577    -122.9607    220.7253
-------------------------------------------------------------------------------------
Instruments for differenced equation
        GMM-type: L(2/.).profic_mat
        Standard: D._IIDescola_35018387 D._IIDescola_35018399 D._IIDescola_35018485 D._IIDescola_35018512 D._IIDescola_35018824
                  D._IIDescola_35059122 D._IIDescola_35059158 D._IIDescola_35059161 D._IIDescola_35059171 D._IIDescola_35059213
                  D._IIDescola_35059225 D._IIDescola_35059237 D._IIDescola_35071122 D._IIDescola_35083811 D._IIDescola_35083847
                  D._IIDescola_35083859 D._IIDescola_35083860 D._IIDescola_35084153 D._IIDescola_35086236 D._IIDescola_35088614
                  D._IIDescola_35088648 D._IIDescola_35088675 D._IIDescola_35088705 D._IIDescola_35112513 D._IIDescola_35112641
                  D._IIDescola_35112859 D._IIDescola_35112872 D._IIDescola_35123067 D._IIDescola_35123080 D._IIDescola_35126846
                  D._IIDescola_35131994 D._IIDescola_35132263 D._IIDescola_35138769 D._IIDescola_35140636 D._IIDescola_35156590
                  D._IIDescola_35159955 D._IIDescola_35162024 D._IIDescola_35172467 D._IIDescola_35172510 D._IIDescola_35172716
                  D._IIDescola_35185103 D._IIDescola_35283685 D._IIDescola_35901124 D._IIDescola_35901143 D._IIDescola_35903917
                  D._IIDescola_35905446 D._IIDescola_35907397 D._IIDescola_35913005 D._IIDescola_35913923 D._IIDescola_35914885
                  D._IIDescola_35924945 D._IIDescola_35924957
Instruments for level equation
        Standard: _cons

.
end of do-file