Announcement

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

  • ivreg2 commands and GMM problems

    Dear all,

    Sorry for not asking a very hard question, but I am in a bit of a jam. I am trying to regress GDP/capita in the European Union from 1990 to 2014. I have 45 variables (investment, gov. expenditure, fdi) and some dummy variables.I posted a message some days ago that I did not undestand why I could not use country dummy variables for my panel data (i have dummy vars - East Europe,West Europe, North Europe, South Europe and West Asia (Cyprus is not included) 5-1=4 dummies to use). If I use a simple regression the dummies are not dropped but in first difference they are all omitted.

    Code:
    Code:
    regress D.y D.x67 D.x68 D.x69 D.x70
    note: _delete omitted because of collinearity
    note: _delete omitted because of collinearity
    note: _delete omitted because of collinearity
    note: _delete omitted because of collinearity
    
          Source |       SS       df       MS              Number of obs =     658
    -------------+------------------------------           F(  0,   657) =    0.00
           Model |           0     0           .           Prob > F      =       .
        Residual |  7.68248688   657  .011693283           R-squared     =  0.0000
    -------------+------------------------------           Adj R-squared =  0.0000
           Total |  7.68248688   657  .011693283           Root MSE      =  .10814
    
    ------------------------------------------------------------------------------
             D.y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             x67 |
             D1. |          0  (omitted)
                 |
             x68 |
             D1. |          0  (omitted)
                 |
             x69 |
             D1. |          0  (omitted)
                 |
             x70 |
             D1. |          0  (omitted)
                 |
           _cons |   .0573657   .0042156    13.61   0.000     .0490881    .0656433
    If I can not use the dummies is not a problem.

    The main issue now is the GMM and system GMM. I am using xtabond2, but i do not now how to separate the endogenous and exogenous indep vars. If I understand correctly i can use ivreg2 to somehow separate the exogenous and endogenous vars. I have read Christopher F. Baum, Mark E. Schaffer (2007) and a lot of other articles. I followed this code in Baum ivreg2 lwage exper expersq (educ=age kidslt6 kidsge6)

    I wrote the following code in Stata 12, but I do not think is the right one.

    Code:
     
     ivreg2 y l.y x2 x3 x6 x7 x8 x9 x10 x11 x12 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x25 x30 x31 x37 x39 x40 x41 x42 x44 x45 x47 x48 x49 x51 x52 x53 x54 x55 x56 x59 x61 x62 x63 x64 x65 x66 (x2= x3 x6 x7 x8 x9 x10 x11 x12 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x25 x30 x31 x37 x39 x40 x41 x42 x44 x45 x47 x48 x49 x51 x52 x53 x54 x55 x56 x59 x61 x62 x63 x64 x65 x66)

    Code:
    . ivreg2 y l.y x2 x3 x6 x7 x8 x9 x10 x11 x12 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x
    > 25 x30 x31 x37 x39 x40 x41 x42 x44 x45 x47 x48 x49 x51 x52 x53 x54 x55 x56 x59 x61 x
    > 62 x63 x64 x65 x66 (x2= x3 x6 x7 x8 x9 x10 x11 x12 x14 x15 x16 x17 x18 x19 x20 x21 x
    > 22 x23 x25 x30 x31 x37 x39 x40 x41 x42 x44 x45 x47 x48 x49 x51 x52 x53 x54 x55 x56 x
    > 59 x61 x62 x63 x64 x65 x66)
    Warning - duplicate variables detected
    Duplicates:    x2 x3 x6 x7 x8 x9 x10 x11 x12 x14 x15 x16 x17 x18 x19 x20 x21 x22
                   x23 x25 x30 x31 x37 x39 x40 x41 x42 x44 x45 x47 x48 x49 x51 x52
                   x53 x54 x55 x56 x59 x61 x62 x63 x64 x65 x66
    Warning - collinearities detected
    Vars dropped:  x61
    
    Ordinary Least Squares (OLS) regression
    ---------------------------------------
    
                                                          Number of obs =      294
                                                          F( 45,   248) =  1623.82
                                                          Prob > F      =   0.0000
    Total (centered) SS     =  139.3348399                Centered R2   =   0.9966
    Total (uncentered) SS   =  28420.33926                Uncentered R2 =   1.0000
    Residual SS             =  .4712928801                Root MSE      =   .04004
    I would not run the ivreg2 if the GMM regression did not have some problems. I tried a GMM code for my model - xtabond2 y l.y x2 x3 x6 x7 x8 x9 x10 x11 x12 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x25 x30 x31 x37 x39 x40 x41 x42 x44 x45 x47 x48 x49 x51 x52 x53 x54 x55 x56 x59 x61 x62 x63 x64 x65 x66, gmm (y x2 x3 x6 x7 x8 x9 x10 x11 x12 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x25 x30 x31 x37 x39 x40 x41 x42 x44 x45 x47 x48 x49 x51 x52 x53 x54 x55 x56 x59 x61 x62 x63 x64 x65 x66 , lag (2 2)) iv(x2 x3 x6 x7 x8 x9 x10 x11 x12 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x25 x30 x31 x37 x39 x40 x41 x42 x44 x45 x47 x48 x49 x51 x52 x53 x54 x55 x56 x59 x61 x62 x63 x64 x65 x66) nolevel small robust

    The tests for the GMM (Arellano-Bond test for AR(1)/AR(2), Sargan are not to high). I think the others are good because are above 10%. If I undestand correctly the indep vars have to be separated in gmm(...., lag (22)) and iv (...)

    Code:
     xtabond2 y l.y x2 x3 x6 x7 x8 x9 x10 x11 x12 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23
    >  x25 x30 x31 x37 x39 x40 x41 x42 x44 x45 x47 x48 x49 x51 x52 x53 x54 x55 x56 x59 x61
    >  x62 x63 x64 x65 x66, gmm (y x2 x3 x6 x7 x8 x9 x10 x11 x12 x14 x15 x16 x17 x18 x19 x
    > 20 x21 x22 x23 x25 x30 x31 x37 x39 x40 x41 x42 x44 x45 x47 x48 x49 x51 x52 x53 x54 x
    > 55 x56 x59 x61 x62 x63 x64 x65 x66 , lag (2 2)) iv(x2 x3 x6 x7 x8 x9 x10 x11 x12 x14
    >  x15 x16 x17 x18 x19 x20 x21 x22 x23 x25 x30 x31 x37 x39 x40 x41 x42 x44 x45 x47 x48
    >  x49 x51 x52 x53 x54 x55 x56 x59 x61 x62 x63 x64 x65 x66) nolevel small robust
    Favoring speed over space. To switch, type or click on mata: mata set matafavor space,
    >  perm.
    x61 dropped due to collinearity
    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 robust weighting matrix for Hansen test.
      Difference-in-Sargan statistics may be negative.
    
    Dynamic panel-data estimation, one-step difference GMM
    ------------------------------------------------------------------------------
    Group variable: Tara                            Number of obs      =       269
    Time variable : An                              Number of groups   =        25
    Number of instruments = 269                     Obs per group: min =         5
    F(45, 25)     =     16.22                                      avg =     10.76
    Prob > F      =     0.000                                      max =        18
    ------------------------------------------------------------------------------
                 |               Robust
               y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
               y |
             L1. |   .6444742   .0535591    12.03   0.000     .5341672    .7547812
                 |
              x2 |   .3267434    .850656     0.38   0.704    -1.425215    2.078702
              x3 |   1.784339   .9669409     1.85   0.077    -.2071135    3.775791
              x6 |   .0820405   .0447111     1.83   0.078    -.0100438    .1741248
              x7 |   .0822454   .0779264     1.06   0.301    -.0782469    .2427378
              x8 |   .0080527   .0035589     2.26   0.033      .000723    .0153823
              x9 |   .0521821   .0473045     1.10   0.280    -.0452433    .1496075
             x10 |   .0717508   .0284243     2.52   0.018       .01321    .1302917
             x11 |  -.0134604   .0123682    -1.09   0.287    -.0389332    .0120125
             x12 |  -.0359401   .0292178    -1.23   0.230    -.0961153    .0242352
             x14 |  -.0576314   .0368055    -1.57   0.130    -.1334338     .018171
             x15 |   .0330871   .0456771     0.72   0.476    -.0609867    .1271609
             x16 |   .0896389   .0609492     1.47   0.154    -.0358883     .215166
             x17 |   -.033444   .0141182    -2.37   0.026     -.062521    -.004367
             x18 |  -.0165842   .0284531    -0.58   0.565    -.0751845     .042016
             x19 |  -.0667013   .0494731    -1.35   0.190     -.168593    .0351903
             x20 |  -.1462139   .0494067    -2.96   0.007    -.2479688   -.0444589
             x21 |    .058025   .0705351     0.82   0.418    -.0872446    .2032947
             x22 |  -.0490903   .0801029    -0.61   0.546    -.2140653    .1158846
             x23 |  -.0016426   .0565918    -0.03   0.977    -.1181956    .1149104
             x25 |  -.0028426   .0057779    -0.49   0.627    -.0147423    .0090572
             x30 |  -.1411703   .1712684    -0.82   0.418    -.4939042    .2115635
             x31 |   -.146848   .1586111    -0.93   0.363    -.4735137    .1798177
             x37 |  -.0821773   .0293899    -2.80   0.010     -.142707   -.0216476
             x39 |   .5071685   .1038441     4.88   0.000     .2932975    .7210395
             x40 |   .0643937   .0459269     1.40   0.173    -.0301945    .1589819
             x41 |   .0670588   .0425339     1.58   0.127    -.0205415     .154659
             x42 |   .0346284   .0318792     1.09   0.288    -.0310281    .1002848
             x44 |  -.0007494   .0024163    -0.31   0.759     -.005726    .0042271
             x45 |   .0216748    .110421     0.20   0.846    -.2057414     .249091
             x47 |  -.1881008   .1707786    -1.10   0.281    -.5398258    .1636243
             x48 |     .06257   .0961805     0.65   0.521    -.1355175    .2606574
             x49 |    .042767   .1191612     0.36   0.723    -.2026501    .2881841
             x51 |   .1317306   .1559247     0.84   0.406    -.1894023    .4528635
             x52 |    .047584   .1013505     0.47   0.643    -.1611513    .2563194
             x53 |  -.2797819   .9026986    -0.31   0.759    -2.138924    1.579361
             x54 |  -.0417117   .9903789    -0.04   0.967    -2.081435    1.998012
             x55 |   .4625591   1.898061     0.24   0.809     -3.44657    4.371688
             x56 |   -.021143    .021437    -0.99   0.333    -.0652933    .0230073
             x59 |   .4616406   .2365719     1.95   0.062    -.0255884    .9488696
             x62 |  -.0186189   .0228488    -0.81   0.423    -.0656769     .028439
             x63 |  -.0232095   .0317936    -0.73   0.472    -.0886897    .0422708
             x64 |   -.067938   .0270667    -2.51   0.019    -.1236829   -.0121931
             x65 |   .0468854   .0922582     0.51   0.616     -.143124    .2368947
             x66 |   .0167629   .0220209     0.76   0.454    -.0285899    .0621157
    ------------------------------------------------------------------------------
    Instruments for first differences equation
      Standard
        D.(x2 x3 x6 x7 x8 x9 x10 x11 x12 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23
        x25 x30 x31 x37 x39 x40 x41 x42 x44 x45 x47 x48 x49 x51 x52 x53 x54 x55
        x56 x59 x61 x62 x63 x64 x65 x66)
      GMM-type (missing=0, separate instruments for each period unless collapsed)
        L2.(y x2 x3 x6 x7 x8 x9 x10 x11 x12 x14 x15 x16 x17 x18 x19 x20 x21 x22
        x23 x25 x30 x31 x37 x39 x40 x41 x42 x44 x45 x47 x48 x49 x51 x52 x53 x54
        x55 x56 x59 x61 x62 x63 x64 x65 x66)
    ------------------------------------------------------------------------------
    Arellano-Bond test for AR(1) in first differences: z =  -2.64  Pr > z =  0.008
    Arellano-Bond test for AR(2) in first differences: z =  -1.72  Pr > z =  0.085
    ------------------------------------------------------------------------------
    Sargan test of overid. restrictions: chi2(224)  = 299.66  Prob > chi2 =  0.001
      (Not robust, but not weakened by many instruments.)
    Hansen test of overid. restrictions: chi2(224)  =   0.00  Prob > chi2 =  1.000
      (Robust, but can be weakened by many instruments.)
    
    Difference-in-Hansen tests of exogeneity of instrument subsets:
      iv(x2 x3 x6 x7 x8 x9 x10 x11 x12 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x25 x30 x31
    >  x37 x39 x40 x41 x42 x44 x45 x47 x48 x49 x51 x52 x53 x54 x55 x56 x59 x61 x62 x63 x64
    >  x65 x66)
        Hansen test excluding group:     chi2(208)  =   0.00  Prob > chi2 =  1.000
        Difference (null H = exogenous): chi2(16)   =   0.00  Prob > chi2 =  1.000


    Thank you all for your help and sorry for posting to many codes.

    Best regards,
    Teodor

  • #2
    I cannot assist with your more substantive problems, but the first difference of variable that does not depend on time - for instance your country dummies - will be a constant zero - it will either be 1 minus 1 or 0 minus 0.

    Differencing should be reserved for those variables that change over time. You should include undifferenced dummies in your differenced model.

    Comment


    • #3
      William - I think you are onto something with the first difference of dummy vars. I searched the forums and some researchers said that there is no problem in first differencing dummy vars. And now i just manually first differenced my dummy vars and saw that the country dummy vars are all 0 in first difference and the ones for corruption - have some 1s and -1s, so they are not dropped in my model. But i have lost alot of observations by doing so. So for x67 x68 x69 x79 (country dummies) i think i should not difference them in my model and the corruption ones also x61 x62 x63 x64 x65 x66. Or should I ???

      Quot from a post of Mr. Wooldridge :
      "Several comments:

      1. Why are you including a lagged dependent variable? If you really want to do this, you should use xtabond or xtabond2.
      2. Dummy variables are treated as all other variables. If you believe the equation written above, just use the differencing operator on the entire equation. Everything gets differenced. (I remain to this day puzzled as to why researchers think there is a problem differencing dummy variables.)

      Here is what I would do, assuming no lagged dependent variables:"

      If someone has a solution for ivreg2 and gmm i will be very grateful.

      Best regards,
      Teodor

      Comment

      Working...
      X