Announcement

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

  • Arellano-Bond in Stata: xtabond, xtabond2, or xtdpdgmm if I'm including an interaction? And can I enter differenced focal variables?

    Hi, I'm trying to run a dynamic panel model in Stata 14.1. I'm not sure if I am coding this correctly, or if perhaps I am getting spurious results because of a mistake I'm making.

    In a 10-year panel with many counties, I'm interested in the effect of a change in a county's robbery rate on a change in the homicide rate, and whether that effect varies in rural versus non-rural counties across 10 years.

    I thought the simplest approach would be:

    Code:
    xtabond D.homicide D.robberies rural Drobberies_rural_interaction a b c y10-y20  if  year>2000 , vce(robust)
    The a b c are controls, and y10-y20 are year fixed effects. I hand-coded the interaction by multiplying the D.robberies variable by the rural dummy (to create the Drobberies_rural_interaction variable). However, Stata keeps dropping that interaction variable because of collinearity (which makes sense since it is a linear combination of 2 of the other variables). My understanding is that when you hand code interaction effects, you need to include each term plus the multiple of the two terms (does that work if one of the terms is a dummy?).

    Specifically, the disappointing output I got from the above is

    Code:
    note: rural dropped from div() because of collinearity
    note: Drobberies_rural_interaction dropped from div() because of collinearity
    note: Drobberies_rural_interaction dropped because of collinearity
    Looking over Statalist, I thought I would try xtabond2 since it should allow interactions, but I keep getting an error.

    I run

    Code:
    xi: xtabond2 D.homicide D.robberies#rural a b c y10-y20  if  year>2000
    but that returned the error
    Code:
    invalid interaction specification;
    the 'D' operator is not allowed with factor variables
    r(198);
    So I dropped the first-difference and ran:

    Code:
    xi: xtabond2 D.homicide c.robberies#i.rural a b c y10-y20  if  year>2000
    But that yielded the following error:

    Code:
    Favoring space over speed. To switch, type or click on mata: mata set matafavor speed, perm.
    Equation not identified. Regessors outnumber instruments.
    So I cut that down to just the main three variables, but I got the same error:

    Code:
    xi: xtabond2 D.homicide c.robberies#i.rural  if  year>2000
    Code:
    Favoring space over speed. To switch, type or click on mata: mata set matafavor speed, perm.
    Equation not identified. Regessors outnumber instruments.
    I don't know how to trim that down any further. Adding another 10 years to the period didn't help, either.

    So my questions are:

    1) What is the best way to do this type of interaction in a dynamic panel model? Should I try xtdpdgmm? The syntax for that command looks a little trickier and I worry I might make a mistake.

    2) Is it OK to include year fixed effects in an Arellano-Bond model? Or is that already handled by the model, and adding the year fixed effects could create spurious results?

    3) Similarly, is it correct to perform an Arellano-Bond model on D.homicide and D.robberies, or would doing so create spurious results? I see from Arellano's paper on this that on the back-end the method does what looks to me like a mean deviation method that first-differences each variable to remove fixed effects. Since I am substantively interested in the CHANGE in homicides and robberies, should I enter those variables as first-differenced as I did in the first code above, and on the back end it will second-difference them? Or in the Arellano-Bond model, should I enter them as not-differenced but just interpret the results as reflecting the effect of a first-differenced change in robberies on a first-differenced change in homicides, without my having to add the "D." to the terms? I haven't seen any papers that plug an already-differenced term in the Arellano-Bond model, so I worry I am violating some aspect of the model...

    Thank you for any feedback!
    Last edited by Sandy Lovejoy; 04 Aug 2020, 22:30.

  • #2
    A few general comments:
    1. You should usually not specify the D. operator in the command line. xtabond automatically applies a first-difference transformation. In your case, you would thus get second differences. The same is true for xtabond2 if you specify the eq(diff) option and for xtdpdgmm if you specify the model(difference) option. Without the D. operator, the usual interpretation of the coefficients applies: What is the effect of a 1-unit change in robberies on (the change in) homicides. If you specify the D. operator, you would get a 1-unit change in the change in robberies.
    2. With xtabond2 or xtdpdgmm, you need to specify the lagged dependent variable explicitly in the list of regressors. It is not included automatically.
    3. With xtabond2 or xtdpdgmm, you need to manually specify the desired instruments. By default, no instruments are specified. Thus, the number of regressors necessarily outnumbers the number of instruments, leading to an error message.
    4. xtdpdgmm has more flexibility than the other commands, which might make the syntax appear trickier. However, I would recommend that you first make yourself familiar with the underlying logic of GMM estimation for dynamic panel models. Once you developed an understanding of the method, the command should be more or less straightforward because you get what you type, while the default settings of the other commands might sometimes be a bit confusing.
    5. Once you specify the appropriate instruments with the iv() and gmm() options of xtabond2 or xtdpdgmm, the use of interaction terms should in principle not cause any problems.
    6. Year-fixed effects are not included by default. You need to specify them manually. xtabond has a bug that might produce incorrect estimates when used with time dummies. xtabond2 has a bug that might produce incorrect results for the overidentification tests when used with time dummies. xtdpdgmm has the teffects options which handles time dummies for you. In many applications, it is recommended to include time dummies to account for global effects that affect all units.

    I recommend to look at some examples in my London Stata Conference presentation from last year. The model selection example at the end of the presentation also uses interaction terms.
    https://www.kripfganz.de/stata/

    Comment


    • #3
      Sebastian, thank you so much. I have spent the day reading your presentation and other materials and trying to implement your suggestions. I think I have done it in xtabond2, but not xtdpdgmm yet (still working on that!). Unfortunately, when I removed the D. operator from the variables, the model really fails the AB test, even though it passed the AB test when I entered D. variables.

      My first question is: Can I take that failure when removing the D. operator to mean that although my first model shows that the differenced AR2 term is not correlated with the differenced term, the new model suggests that the non-differenced AR2 term is correlated with the non-differenced term? I'm not sure if I'm interpreting that aspect of the test correctly.

      So for my main result I was trying to recreate the below but adding in a rural interaction term.
      Code:
      xtabond  homicide rob rural a b c d y40-y48  if  year>2000,  lags(4)
      Here is my code and output from trying to recreate that with a robbery/rural interaction in xtabond2:

      Code:
      . xtabond2 homicide L.homicide L2.homicide L3.homicide L4.homicide c.rob##i.rural a b c d
      y40-y48  if  year>2000, gmm(L.homicide L2.homicide L3.homicide L4.homicide, eq(d))
      iv(rob  rural a b c d y40-y48, eq(d))
      
      Favoring space over speed. To switch, type or click on mata: mata set matafavor speed, perm.
      
      Dynamic panel-data estimation, one-step system GMM
      ------------------------------------------------------------------------------
      Group variable: fips                            Number of obs      =     29285
      Time variable : year                            Number of groups   =      2931
      Number of instruments = 230                     Obs per group: min =         3
      Wald chi2(22) =  24605.22                                      avg =      9.99
      Prob > chi2   =     0.000                                      max =        10
      --------------------------------------------------------------------------------------
                     homicide|      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      ---------------------+----------------------------------------------------------------
                     homicide|
                       L1. |   .5962766   .0086381    69.03   0.000     .5793462     .613207
                       L2. |  -.0506549   .0075414    -6.72   0.000    -.0654358    -.035874
                       L3. |  -.0251341   .0075459    -3.33   0.001    -.0399238   -.0103445
                       L4. |   .0051212   .0061604     0.83   0.406    -.0069529    .0171953
                           |
                        rob|   .0222804    .005221     4.27   0.000     .0120474    .0325133
                           |
                      rural|
                        0  |          0  (empty)
                        1  |          0  (omitted)
                           |
         i.rural#c.rob |
                        0  |          0  (empty)
                        1  |  -7.265918   .5685066   -12.78   0.000    -8.380171   -6.151666
                           |
                         a |   .4957376   .0222859    22.24   0.000     .4520581    .5394171
                         b |    -.04357   .0263237    -1.66   0.098    -.0951636    .0080236
                         c |   .2847131    .031799     8.95   0.000     .2223883     .347038
                         d |  -3.397263   1.837127    -1.85   0.064    -6.997966    .2034405
                       y40 |  -.0160416    .000474   -33.84   0.000    -.0169707   -.0151126
                       y41 |   -.017294   .0005102   -33.90   0.000     -.018294    -.016294
                       y42 |  -.0053661   .0005517    -9.73   0.000    -.0064474   -.0042847
                       y43 |  -.0012032   .0005922    -2.03   0.042    -.0023638   -.0000425
                       y44 |  -.0003896   .0006295    -0.62   0.536    -.0016234    .0008442
                       y45 |   .0043615   .0006794     6.42   0.000       .00303    .0056931
                       y46 |   .0069086   .0007177     9.63   0.000     .0055021    .0083152
                       y47 |    .010225    .000756    13.52   0.000     .0087433    .0117068
                       y48 |   .0137343   .0008008    17.15   0.000     .0121648    .0153037
                     _cons |  -.1217482   .0062736   -19.41   0.000    -.1340443   -.1094521
      --------------------------------------------------------------------------------------
      Instruments for first differences equation
        Standard
          D.(rob a b c d y40 y41 y42
          y43 y44 y45 y46 y47 y48)
        GMM-type (missing=0, separate instruments for each period unless collapsed)
          L(1/27).(L.homicide L2.homicide L3.homicide L4.homicide)
      Instruments for levels equation
        Standard
          _cons
      ------------------------------------------------------------------------------
      Arellano-Bond test for AR(1) in first differences: z = -31.96  Pr > z =  0.000
      Arellano-Bond test for AR(2) in first differences: z =  -8.96  Pr > z =  0.000
      ------------------------------------------------------------------------------
      Sargan test of overid. restrictions: chi2(207)  =5788.99  Prob > chi2 =  0.000
        (Not robust, but not weakened by many instruments.)
      
      Difference-in-Sargan tests of exogeneity of instrument subsets:
        iv(jailadm2 white2 proprate3 male15642 popdensitypermillion y40 y41 y42 y43 y44 y45 y46 y47 y48, eq(d
      > iff))
          Sargan test excluding group:     chi2(193)  =5509.22  Prob > chi2 =  0.000
          Difference (null H = exogenous): chi2(14)   = 279.77  Prob > chi2 =  0.000
      I have a couple questions.

      1. Do you think I 'translated' that correctly to xtabond2?

      2. I know this model failed the Arellano-Bond AR2 test because the test statistic was significant, but for the overidentifcation and exogeneity tests, do significant test statistics also mean the model failed those? Also, other examples on Statalist seem to include other test results, and I'm not sure why my results don't include other tests such as the Hansen...

      3. To use a stationary GMM, would I just replace "eq(d)" with "eq(level)" as in the following? When is it appropriate to do that?
      Code:
      . xtabond2 homicide L.homicide L2.homicide L3.homicide L4.homicide c.rob##i.rural a b c d
      y40-y48 if year>2000, gmm(L.homicide L2.homicide L3.homicide L4.homicide, eq(level)) iv(rob a b c d y40-y48, eq(level))

      4. I am still working on how to translate this to xtdpdgmm, if you have any pointers! I am slow because I want to be sure I am not accidentally changing the model. Once I am confident that I can recreate the same model in xtabond, xtabond2, and xtdpdgmm, I will use your xtdpdgmm, since it has all the advantages you had articulated. Thank you again for developing xtdpdgmm and for helping me and others figure out how to implement it.
      Last edited by Sandy Lovejoy; 05 Aug 2020, 21:15.

      Comment


      • #4
        I am not sure I understand your first question. The AR(2) test is a test that the first-differenced error has no second-order serial correlation when the model is formulated in levels. When you formulate the model in first differences, you would test whether there is no second-order serial correlation in the second-differenced error term.

        Regarding your other questions:
        1. By default, xtabond treats all indepvars as strictly exogenous. The list of instruments below the regression output indicates how the instruments are formed. I recommend to start with a very simple model and try to replicate the simple model with the different commands to understand the syntax, and the step-by-step extend the model. You can find some examples for equivalent command syntaxes on slides 5 and 6 of my 2019 London Stata Conference presentation.
        2. Yes, the overidentification tests should also not reject the null hypothesis. I do not know why xtabond2 does not display the Hansen test in your case.
        3. Not sure what you mean by "stationary GMM". For a system GMM estimator that uses additional instruments valid under mean stationarity, you would add these additional instruments for the level model to those that you already have for the first-differenced model. Please have a look at Roodman's "How to do xtabond2?" article for a discussion in the context of this command.
        4. As suggested in point 1, I recommend to start with a simple example and then step-by-step extend the model.
        https://www.kripfganz.de/stata/

        Comment


        • #5
          Dear Statalist users

          I am new here. I have a database with 15 plus years and 920,000 observations. Due to a dynamic environment where companies come and go, the data on that .dta file became an unbalanced panel. On the topic investigated, I seek to maximize, return on assets measured by Wroa1 (dependent variable). Endogenous variables return on assets (Wroa1), Winvperiod1, Wpayperiod1, and Warperiod1. Instruments GDPgrowth, Lending_interest_rate (other variables were tested as well).
          After running POLS, Least Square Dummy Variables (LSDV) using fixed effects (Hausman test recommends fixed effects).
          To address the issue of endogeneity. I used GMM system two-step implementing xtabond2. My results partially comply with the specifications of Arellano Bond (1991), Arellano Bover (1995), Blundell Bond (1998) and Roodman (2009). However, it seems as if the outcome is still not functional. On the GMM estimations, I used dichotomical variables for each year. Initially I tried the most recent lags (1 2). Later I realized that more distant lags were needed lag (4 5). Stata’s command xtabond2 did not respond properly as the before mentioned 920,000 observations weighted 891MB (thus the software disclaimed an error). The underlying problem is that:

          iv(GDPgrowth LNsales Wopercashfl21 Lending_interest_rate, eq(level))
          Hansen test excluding group: chi2(96) = 44.65 Prob > chi2 = 1.000
          Difference (null H = exogenous): chi2(4) = 131.54 Prob > chi2 = 0.000

          xtabond2 Wroa1 l.Wroa1 L2.Wroa1 l.Winvperiod1 l.Wpayperiod1 l.Warperiod1 Wdebtrat1 l.Wcurrasstotasset1 l.Winvencurrass1 l.Wopercashfl21 $danolist, ///
          > twostep ivstyle(GDPgrowth LNsales Wdebtrat1 Wopercashfl21 Lending_interest_rate $danolist, eq(level)) ///
          > gmmstyle(l.Winvperiod1, lag (4 5)) gmmstyle(l.Wpayperiod1, lag (4 5)) gmmstyle(l.Warperiod1, lag(4 5)) robust small orthogonal artests(3)
          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: code Number of obs = 33890
          Time variable : ano Number of groups = 9380
          Number of instruments = 133 Obs per group: min = 1
          F(28, 9379) = 667.03 avg = 3.61
          Prob > F = 0.000 max = 16
          -----------------------------------------------------------------------------------
          | Corrected
          Wroa1 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
          ------------------+----------------------------------------------------------------
          Wroa1 |
          L1. | .9266805 .2317706 4.00 0.000 .4723599 1.381001
          L2. | .486574 .1884608 2.58 0.010 .11715 .8559979
          |
          Winvperiod1 |
          L1. | -.000157 .0000644 -2.44 0.015 -.0002833 -.0000308
          |
          Wpayperiod1 |
          L1. | .0001359 .000056 2.43 0.015 .0000261 .0002457
          |
          Warperiod1 |
          L1. | .0001288 .0000946 1.36 0.173 -.0000567 .0003143
          |
          Wdebtrat1 | .0351673 .0123732 2.84 0.004 .0109132 .0594215
          |
          Wcurrasstotasset1 |
          L1. | .0033437 .0323069 0.10 0.918 -.0599848 .0666721
          |
          Winvencurrass1 |
          L1. | .1358249 .044686 3.04 0.002 .0482308 .2234191
          |
          Wopercashfl21 |
          L1. | .3631804 .1766494 2.06 0.040 .0169092 .7094516
          |
          dano1 | 0 (omitted)
          dano2 | 0 (omitted)
          dano3 | 0 (omitted)
          dano4 | -.1413164 .0194979 -7.25 0.000 -.1795365 -.1030964
          dano5 | -.1048038 .0170585 -6.14 0.000 -.1382422 -.0713654
          dano6 | -.1200113 .0175975 -6.82 0.000 -.1545063 -.0855164
          dano7 | -.1363995 .0187399 -7.28 0.000 -.1731337 -.0996653
          dano8 | -.1321263 .0184439 -7.16 0.000 -.1682803 -.0959722
          dano9 | -.1360189 .0189258 -7.19 0.000 -.1731175 -.0989203
          dano10 | -.1600287 .0200483 -7.98 0.000 -.1993278 -.1207297
          dano11 | -.1667213 .0210772 -7.91 0.000 -.2080373 -.1254054
          dano12 | -.160589 .0209581 -7.66 0.000 -.2016714 -.1195066
          dano13 | -.1439545 .0206509 -6.97 0.000 -.1844347 -.1034743
          dano14 | -.1393673 .0189175 -7.37 0.000 -.1764497 -.1022849
          dano15 | -.1237161 .0187611 -6.59 0.000 -.160492 -.0869403
          dano16 | -.1474755 .0156588 -9.42 0.000 -.1781701 -.1167808
          dano17 | -.1721201 .0225874 -7.62 0.000 -.2163963 -.127844
          dano18 | -.1455564 .0213352 -6.82 0.000 -.1873781 -.1037347
          dano19 | -.1555622 .0199941 -7.78 0.000 -.194755 -.1163695
          _cons | 0 (omitted)
          -----------------------------------------------------------------------------------
          Instruments for orthogonal deviations equation
          GMM-type (missing=0, separate instruments for each period unless collapsed)
          L(4/5).L.Warperiod1
          L(4/5).L.Wpayperiod1
          L(4/5).L.Winvperiod1
          Instruments for levels equation
          Standard
          GDPgrowth LNsales Wdebtrat1 Wopercashfl21 Lending_interest_rate dano1
          dano2 dano3 dano4 dano5 dano6 dano7 dano8 dano9 dano10 dano11 dano12
          dano13 dano14 dano15 dano16 dano17 dano18 dano19
          _cons
          GMM-type (missing=0, separate instruments for each period unless collapsed)
          DL3.L.Warperiod1
          DL3.L.Wpayperiod1
          DL3.L.Winvperiod1
          ------------------------------------------------------------------------------
          Arellano-Bond test for AR(1) in first differences: z = -3.04 Pr > z = 0.002
          Arellano-Bond test for AR(2) in first differences: z = -1.73 Pr > z = 0.083
          Arellano-Bond test for AR(3) in first differences: z = 3.69 Pr > z = 0.000
          ------------------------------------------------------------------------------
          Sargan test of overid. restrictions: chi2(104) = 94.11 Prob > chi2 = 0.746
          (Not robust, but not weakened by many instruments.)
          Hansen test of overid. restrictions: chi2(104) = 111.03 Prob > chi2 = 0.300
          (Robust, but weakened by many instruments.)

          Difference-in-Hansen tests of exogeneity of instrument subsets:
          GMM instruments for levels
          Hansen test excluding group: chi2(63) = 67.25 Prob > chi2 = 0.334
          Difference (null H = exogenous): chi2(41) = 43.78 Prob > chi2 = 0.354
          gmm(L.Winvperiod1, lag(4 5))
          Hansen test excluding group: chi2(71) = 73.41 Prob > chi2 = 0.399
          Difference (null H = exogenous): chi2(33) = 37.62 Prob > chi2 = 0.266
          gmm(L.Wpayperiod1, lag(4 5))
          Hansen test excluding group: chi2(63) = 67.75 Prob > chi2 = 0.318
          Difference (null H = exogenous): chi2(41) = 43.28 Prob > chi2 = 0.374
          gmm(L.Warperiod1, lag(4 5))
          Hansen test excluding group: chi2(64) = 67.65 Prob > chi2 = 0.354
          Difference (null H = exogenous): chi2(40) = 43.38 Prob > chi2 = 0.329
          iv(GDPgrowth LNsales Wdebtrat1 Wopercashfl21 Lending_interest_rate dano1 dano2 dano3 dano4 dano5 dano6 dano7 dano8 dano9 dano10
          > dano11 dano12 dano13 dano14 dano15 dano16 dano17 dano18 dano19, eq(level))
          Hansen test excluding group: chi2(86) = 40.48 Prob > chi2 = 1.000
          Difference (null H = exogenous): chi2(18) = 70.56 Prob > chi2 = 0.000


          To overcome the issue of the unbalanced data. I ran a second regression where I used 5 consecutive years per company for fifteen years. Significant amount of observations were deleted after cleaning the data. The new balanced panel contained 36,700 observations (32MB) and Stata ran faster (except when “nomata” option is used). The estimation improved, but the biggest issue now is that commands xtabond2, xtdpdsys and xtdpdgmm revealed on the “Arellano-Bond test for autocorrelation“ shows AR(1) but it does not shows AR(2) or AR(3). Interestingly, xtsum shows that most variables had 5 observations except for a few that had 3 because of the lags.

          Arellano-Bond test for AR(1) in first differences: z = -5.52 Pr > z = 0.000
          Arellano-Bond test for AR(2) in first differences: z = . Pr > z = .

          xtabond2 Wroa1 l.Wroa1 L2.Wroa1 l.Winvperiod1 l.Wpayperiod1 l.Warperiod1 $danolist, ///
          > twostep ivstyle(GDPgrowth Domestic_creditpercentGDP, eq(level)) ///
          > gmmstyle(Winvperiod1, lag (2 3)) gmmstyle(Wpayperiod1, lag (3 3)) gmmstyle(Warperiod1, lag(3 3)) robust small orthogonal
          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: code Number of obs = 21993
          Time variable : ano Number of groups = 7331
          Number of instruments = 116 Obs per group: min = 3
          F(24, 7330) = 1805.71 avg = 3.00
          Prob > F = 0.000 max = 3
          ------------------------------------------------------------------------------
          | Corrected
          Wroa1 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
          -------------+----------------------------------------------------------------
          Wroa1 |
          L1. | .4894689 .1175138 4.17 0.000 .259108 .7198297
          L2. | .0193082 .0496369 0.39 0.697 -.0779945 .1166108
          |
          Winvperiod1 |
          L1. | -.0000528 .0000312 -1.69 0.091 -.0001141 8.37e-06
          |
          Wpayperiod1 |
          L1. | .0000184 .000029 0.64 0.525 -.0000384 .0000753
          |
          Warperiod1 |
          L1. | -.0000418 .0000753 -0.56 0.579 -.0001894 .0001058
          |
          dano1 | 0 (omitted)
          dano2 | 0 (omitted)
          dano3 | .0472461 .0127304 3.71 0.000 .0222909 .0722013
          dano4 | .0278142 .0121204 2.29 0.022 .0040546 .0515737
          dano5 | .0505534 .0103758 4.87 0.000 .0302139 .0708929
          dano6 | .0471844 .0117596 4.01 0.000 .0241322 .0702366
          dano7 | .0469343 .0113797 4.12 0.000 .0246268 .0692418
          dano8 | .0554627 .011277 4.92 0.000 .0333565 .0775688
          dano9 | .0606597 .0126613 4.79 0.000 .03584 .0854794
          dano10 | .0508695 .0139736 3.64 0.000 .0234774 .0782617
          dano11 | .046546 .0131103 3.55 0.000 .0208459 .072246
          dano12 | .0456814 .0122964 3.72 0.000 .021577 .0697859
          dano13 | .0529536 .0121963 4.34 0.000 .0290452 .0768619
          dano14 | .0599291 .01291 4.64 0.000 .0346217 .0852364
          dano15 | .070268 .0140831 4.99 0.000 .042661 .0978751
          dano16 | .0470513 .0137043 3.43 0.001 .0201869 .0739156
          dano17 | .0459834 .0136695 3.36 0.001 .0191872 .0727796
          dano18 | .058258 .0130257 4.47 0.000 .0327239 .0837921
          dano19 | .0436257 .0146724 2.97 0.003 .0148636 .0723879
          _cons | 0 (omitted)
          ------------------------------------------------------------------------------
          Instruments for orthogonal deviations equation
          GMM-type (missing=0, separate instruments for each period unless collapsed)
          L3.Warperiod1
          L3.Wpayperiod1
          L(2/3).Winvperiod1
          Instruments for levels equation
          Standard
          GDPgrowth Domestic_creditpercentGDP
          _cons
          GMM-type (missing=0, separate instruments for each period unless collapsed)
          DL2.Warperiod1
          DL2.Wpayperiod1
          DL.Winvperiod1
          ------------------------------------------------------------------------------
          Arellano-Bond test for AR(1) in first differences: z = -5.52 Pr > z = 0.000
          Arellano-Bond test for AR(2) in first differences: z = . Pr > z = .
          ------------------------------------------------------------------------------
          Sargan test of overid. restrictions: chi2(91) = 106.18 Prob > chi2 = 0.132
          (Not robust, but not weakened by many instruments.)
          Hansen test of overid. restrictions: chi2(91) = 100.22 Prob > chi2 = 0.239
          (Robust, but weakened by many instruments.)

          Difference-in-Hansen tests of exogeneity of instrument subsets:
          GMM instruments for levels
          Hansen test excluding group: chi2(41) = 41.31 Prob > chi2 = 0.457
          Difference (null H = exogenous): chi2(50) = 58.92 Prob > chi2 = 0.182
          gmm(Winvperiod1, lag(2 3))
          Hansen test excluding group: chi2(45) = 44.94 Prob > chi2 = 0.475
          Difference (null H = exogenous): chi2(46) = 55.29 Prob > chi2 = 0.164
          gmm(Wpayperiod1, lag(3 3))
          Hansen test excluding group: chi2(58) = 65.10 Prob > chi2 = 0.244
          Difference (null H = exogenous): chi2(33) = 35.13 Prob > chi2 = 0.368
          gmm(Warperiod1, lag(3 3))
          Hansen test excluding group: chi2(57) = 65.98 Prob > chi2 = 0.194
          Difference (null H = exogenous): chi2(34) = 34.24 Prob > chi2 = 0.456
          iv(GDPgrowth Domestic_creditpercentGDP, eq(level))
          Hansen test excluding group: chi2(89) = 94.67 Prob > chi2 = 0.321
          Difference (null H = exogenous): chi2(2) = 5.55 Prob > chi2 = 0.062


          I would really appreciate your kind help pointing me on the right direction.

          Kind regards,

          Paul.

          Comment


          • #6
            Unbalanced panel data should not be a problem. If Stata takes a long time to compute the results with the large data set, it is just because of the total number of observations, not because the data set is unbalanced.

            With your reduced data set, there are only 3 consecutive time periods used in the estimation. Note that you effectively lose 2 time periods because of the lags of the dependent variable. To compute an AR(2) test statistic, you need more than those 3 effective time periods.
            https://www.kripfganz.de/stata/

            Comment


            • #7
              Hi, thank you so much for your guidance on my last questions. I decided to take some time studying your writings on this method. Since I am using time fixed effects, I switched from xtabond2 to your function. I have a couple lingering questions.

              First, here is my revised approach:

              Code:
              xtdpdgmm DHomicideRate L.DHomicideRate L2.DHomicideRate ( cD.GunRate)## (i.RepublicanControl)
              > Southern D.PropertyCrimeRate D.ImmigrationRate D.EducationRate D.HomeOwnershipRate, gmmiv
              >(L.DHomicideRate L2.DHomicideRate D.RobberyRate RepublicanControl Southern D.PropertyCrimeRate
              > D.ImmigrationRate D.EducationRate D.HomeOwnershipRate, model(level) lagrange(1 4) collapse)
              >  twostep vce(robust) teffects
              
              Generalized method of moments estimation
              
              Fitting full model:
              Step 1         f(b) =  .00001461
              Step 2         f(b) =  .31568819
              
              Group variable: fips                         Number of obs         =       618
              Time variable: year                          Number of groups      =        62
              
              Moment conditions:     linear =      40      Obs per group:    min =         8
              nonlinear =       0                        avg =  9.967742
              total =      40                        max =        10
              
              (Std. Err. adjusted for 62 clusters in fips)
              
              WC-Robust
              DHomicideRate         Coef.   Std. Err.      z    P>z     [95% Conf. Interval]
              
              DHomicideRate
              LD.    .0265459   .0494842     0.54   0.592    -.0704414    .1235332
              L2D.   -.0717272   .0378986    -1.89   0.058    -.1460071    .0025527
                                        
              GunRate
              D1.    .3166562   .1599545     1.98   0.048     .0031511    .6301613
                                        
              1.RepublicanControl-.0007289   .0007526    -0.97   0.333     -.002204    .0007461
                                        
              RepublicanControl#cD.GunRate
              1    -.4156727   .1834059    -2.27   0.023    -.7751417   -.0562037
                                        
              Southern    .0001485   .0006349     0.23   0.815    -.0010959    .0013929
                                        
              PropertyCrimeRate
              D1.    .1755948   .5799439     0.30   0.762    -.9610743    1.312264
                                        
              ImmigrationRate
              D1.    .3653269   .4064281     0.90   0.369    -.4312575    1.161911
                                        
              EducationRate
              D1.    -.261754   2.321805    -0.11   0.910    -4.812407    4.288899
                                        
              HomeOwnershipRate
              D1.    .3961247   .1386067     2.86   0.004     .1244605    .6677889
                                        
              year
              1999    -.0159765   .0021585    -7.40   0.000     -.020207    -.011746
              2000     .0178336   .0042623     4.18   0.000     .0094797    .0261876
              2001     .0065243   .0017865     3.65   0.000     .0030229    .0100257
              2002     .0116196   .0011619    10.00   0.000     .0093424    .0138968
              2003     .0085989   .0011328     7.59   0.000     .0063786    .0108193
              2004     .0113242    .001277     8.87   0.000     .0088213    .0138272
              2005     .0098162    .001458     6.73   0.000     .0069585    .0126738
              2006     .0120986    .001452     8.33   0.000     .0092528    .0149444
              2007     .0130326    .001348     9.67   0.000     .0103905    .0156747
                                        
              _cons    -.004682   .0012862    -3.64   0.000     -.007203   -.0021611
              
              Instruments corresponding to the linear moment conditions:
              1, model(level):
              L1.RepublicanControl  L2.RepublicanControl L3.RepublicanControl L4.RepublicanControl
              L1.LDHomicideRate        L2.L.DHomicideRate         L3.L.DHomicideRate        
              L4.L.DHomicideRate        L4.L2.DHomicideRate        L1.D.GunRate L2.D.GunRate
              L3.D.GunRate L4.D.GunRate  L1.Southern L1.D.PropertyCrimeRate
              L2.D.PropertyCrimeRate L3.D.PropertyCrimeRate L4.D.PropertyCrimeRate
              L1.D.ImmigrationRate L2.D.ImmigrationRate L3.D.ImmigrationRate L4.D.ImmigrationRate
              L1.D.EducationRate  L2.D.EducationRate L3.D.EducationRate
              L4.D.EducationRate  L1.D.HomeOwnershipRate  L2.D.HomeOwnershipRate L3.D.HomeOwnershipRate
              L4.D.HomeOwnershipRate
              2, model(level):
              1999bn.year 2000.year 2001.year 2002.year 2003.year 2004.year 2005.year
              2006.year 2007.year
              3, model(level):
              _cons
              
              . estat overid
              
              Sargan-Hansen test of the overidentifying restrictions
              H0: overidentifying restrictions are valid
              
              2-step moment functions, 2-step weighting matrix       chi2(20)    =   19.5727
              Prob > chi2 =    0.4849
              
              2-step moment functions, 3-step weighting matrix       chi2(20)    =   36.4823
              Prob > chi2 =    0.0135
              
              . estat serial
              
              Arellano-Bond test for autocorrelation of the first-differenced residuals
              H0: no autocorrelation of order 1:     z =   -4.3919   Prob > z  =    0.0000
              H0: no autocorrelation of order 2:     z =   -0.5945   Prob > z  =    0.5522
              1. I am in interested in the effect of annual growth in Gun Ownership Rates on annual growth in Homicide Rates, and how that varies based on Republican control of local government. I am trying to do a system GMM, so therefore is it OK for me to difference each of the terms, as I did above? I understand that if I were using the difference model I would not add "D." to the terms when inputting them, but to get the annual growth rate, I should add the "D." operator here, right?

              2. In your last advice, you told me to "add these additional instruments for the level model to those that you already have for the first-differenced model." I don't think I am doing that with the code above, since I am putting all the instruments in the 'gmmiv' subcommand. For a typical system GMM analysis, is it OK to do it as I did it here, or should I add a set of instruments with a "model(diff)"? I do not want to assume my instruments are exogenous, so I am trying to treat them as potentially endogenous.

              3. Related to the last point, I understand that there is a trade-off between weakness and exogeneity in the lag structure of the instruments. I am trying to assume they are endogenous, hence "lag range (1 4)" rather than "lag range (0 4)." Does that seem appropriate? I think that if I included a 0 lag, I would by assumption be including an endogenous instrument, right? Does it look like I included the appropriate lags in the model?

              4. I am a little puzzled about the overidentification test having such different results in the 2-step and 3-step versions. I believe in another reply you said this is due to weakly associated instruments that are unstable, right? When I use (1 3) lag limits, I get
              Code:
              estat overid
              
              Sargan-Hansen test of the overidentifying restrictions
              H0: overidentifying restrictions are valid
              
              2-step moment functions, 2-step weighting matrix    chi2(11)    =    12.9363
                  Prob > chi2    =    0.2975
              
              2-step moment functions, 3-step weighting matrix    chi2(11)    =    20.6465
                  Prob > chi2    =    0.0372
              Which is slightly better but not much better. When I use (1 2) it drops from 40 to 26 instruments and the 2-step and 3-step tests are much closer, but it's a little TOO small a set of instruments -- not a single point estimate is close to statistically significant, even the lags of the DV.

              5. I get pretty similar point estimates but quite different standard errors when I try to execute this in xtabond2. Is that something to worry about? Can I assume it is because of the problem xtabond2 has with year fixed effects, plus in your command I am using the Windmeijer robustness approach? Or should I further investigate why I get different results?

              Thank you so much for any insights you might have! I have really tried my best to follow your London presentation, but I apologize if I have made any dunderheaded mistakes.
              Last edited by Sandy Lovejoy; 23 Aug 2020, 21:25.

              Comment


              • #8
                1. By differencing the variables manually and then specifying instruments for model(level), you essentially have run a difference-GMM estimation. For a system-GMM estimation, you should not difference the variables manually. Instruments for the differenced model can then be specified with model(diff). You can then add further instruments for model(level) to obtain a system-GMM estimator.
                2. See number 1.
                3. If your model is first differenced, either manually or by specifying model(diff), the error term is expected to exhibit first-order serial correlation. This causes the first lag of an endogenous variable to still be endogenous. For such variables you should choose lag(2 4). lag(1 4) would be appropriate for predetermined (weakly exogenous) variables.
                4. It is difficult to say what exactly the reason is for the observed difference in the overidentification tests. Weak instruments (or too many instruments) could be a reason. You could also try the iterated GMM estimator with option igmm instead of the two-step GMM estimator to avoid the sensitivity to the weighting matrix.
                5. In principle, you should be able to exactly replicate your results with xtabond2. It also applies the Windmeijer correction if you specify the robust option for two-stage estimators. If the results differ, then the model specification probably differs in certain ways. The presence of time-fixed effects should not affect the point estimates or standard errors when comparing xtdpdgmm to xtabond2.
                https://www.kripfganz.de/stata/

                Comment


                • #9
                  Hi, thank you so much. I'm a little confused about your point (1). Am I understanding correctly that to do a system-GMM estimation, I should include BOTH a model(diff) term and a model(level) term?

                  Code:
                  xtdpdgmm HomicideRate L.HomicideRate L2.HomicideRate ( c.GunRate)## (i.RepublicanControl)
                  > Southern PropertyCrimeRate ImmigrationRate EducationRate HomeOwnershipRate, gmmiv
                  >(L.HomicideRate L2.HomicideRate RobberyRate RepublicanControl Southern PropertyCrimeRate
                  > ImmigrationRate EducationRate HomeOwnershipRate, model(level) lagrange(1 4) collapse)
                  >gmmiv(L.DHomicideRate L2.DHomicideRate D.RobberyRate RepublicanControl Southern D.PropertyCrimeRate
                  > D.ImmigrationRate D.EducationRate D.HomeOwnershipRate, model(diff) lagrange(2 4) collapse)
                  > twostep vce(robust) teffects
                  In that change, I made the lags of the system-GMM (1 4) and the lag range of the difference-GMM (2 4). It gets similar test statistics as the model I posted yesterday. So I have one basic question that I will try to explain:

                  How would I then interpret the point estimates in the revised model, though? Below is the main result of interest, which is similar as above, but slightly different (-.47 rather than -.42). But the model I posted yesterday was about the changes in differenced variables (i.e., the annual growth rate of the gun ownership rate on the annual growth rate of the homicide rate), whereas this seems to be an estimate of a change in the levels of the non-differenced variables (which I would have expected to be totally different from the estimate of the change in annual growth rates).

                  Code:
                   RepublicanControl#c.GunRate |                         1  |  -.4661369   .2227147    -2.09   0.036    -.9026498   -.0296241
                  1. Considering I included both system and difference GMM estimators in this new code, would these point estimates represent a change in the annual growth rate, or a change in the level? This is substantively completely different, so I really want to be sure I'm not misunderstanding this. My goal is to obtain a GMM estimate of a change in the annual growth rate of the predictor, on the annual growth rate of the outcome. I thought I should therefore obtain a system-GMM estimate of the annual growth rates, but is this just the same thing as specifying a difference model? Or is it that if I include both a system-GMM estimator AND a difference-GMM estimator, but don't manually difference the input variables (as in this revised code), I am doing a system-GMM analysis of annual growth rates?

                  My understanding was that the difference-GMM uses differences of the variables as instruments, to estimate the effects of levels on levels (rather than using differences as instruments, to estimate the effects of differences in levels on differences in levels).

                  I think this is a fundamental misunderstanding on my part, so I really appreciate your patience in helping me understand this!
                  Last edited by Sandy Lovejoy; 24 Aug 2020, 11:54.

                  Comment


                  • #10
                    The system GMM estimator indeed typically involves an equation in first differences and one in levels, hence the term "system". The instruments for model(level) are usually differenced: add suboption diff, not to be confused with model(diff).

                    Differencing of the model is usually just part of the estimation technique. You would in most cases still interpret the coefficients for the level model. This would typically be the effect of a 1-unit change of the explanatory variable on the growth rate of the dependent variable (in percentage points). Conditional on the lagged dependent variable, this is approximately the same as the effect on the level of the dependent variable (in percent).

                    In short: a 1 percent change in a variable is about the same as a 1 percentage-point change in the growth rate of that variable, everything else equal.

                    Originally posted by Sandy Lovejoy View Post
                    My understanding was that the difference-GMM uses differences of the variables as instruments, to estimate the effects of levels on levels (rather than using differences as instruments, to estimate the effects of differences in levels on differences in levels).
                    No, a difference-GMM estimator uses levels of the variables as instruments for the first-differenced regressors.
                    A level-GMM estimator uses differences of the variables as instruments for the level regressors.
                    A system-GMM estimator combines the two.
                    https://www.kripfganz.de/stata/

                    Comment


                    • #11
                      Sebastian, thank you so much. The way you explain things is so crystal clear, and you corrected my misunderstanding of how the system GMM works.

                      Just to be sure that I understand it, my syntax for a system GMM (changing the variable names for simplicity) in which I am interested in the effect of x on y, conditional on z and controlling for a b c d, would be:

                      Code:
                      xtdpdgmm y L.y L2.y (x L.x)##(z) a b c d,
                      >gmmiv (L.y L2.y x L.x z a b c d, model(level) lagrange(1 4) collapse)
                      >gmmiv (L.y L2.y x L.x z a b c d, model(level) diff lagrange(2 4) collapse)
                      > twostep vce(robust) teffects
                      Does that look right? Is it OK if another variation only includes x, but not L.x as a predictor? I am trying to follow your model selection protocol starting on page 90 of your London presentation.

                      With the above syntax, the model passes some but not all the tests:

                      Code:
                      Group variable: fips            Number of obs        =    619
                      Time variable: year            Number of groups        =    62
                      
                      Moment conditions:     linear    =    51    Obs per group:    min    =    9
                      nonlinear    =    0        avg    =    9.983871
                      total    =    51        max    =    10
                      Code:
                      . estat overid
                      
                      Sargan-Hansen test of the overidentifying restrictions
                      H0: overidentifying restrictions are valid
                      
                      2-step moment functions, 2-step weighting matrix    chi2(29)    =    27.5228
                          Prob > chi2    =    0.5435
                      
                      2-step moment functions, 3-step weighting matrix    chi2(29)    =    47.9178
                          Prob > chi2    =    0.0150
                      Code:
                      . estat overid, difference
                      
                      Sargan-Hansen (difference) test of the overidentifying restrictions
                      H0: (additional) overidentifying restrictions are valid
                      
                      2-step weighting matrix from full model
                      
                      Excluding                    Difference            
                      Moment conditions        chi2     df         p         chi2     df    p
                          
                      1, model(level)      4.3689      5    0.4976      23.1538     24    0.5107
                      2, model(level)     14.2526     12    0.2849      13.2701     17    0.7179
                      3, model(level)     21.1599     20    0.3878       6.3629      9    0.7031
                      Code:
                      . estat serial, ar(3)
                      
                      Arellano-Bond test for autocorrelation of the first-differenced residuals
                      H0: no autocorrelation of order 3:     z =    0.3132   Prob > |z|  =    0.7541

                      Code:
                      .  underid, underid kp sw noreport
                      
                      Underidentification test: Kleibergen-Paap robust LIML-based (LM version)
                      Test statistic robust to heteroskedasticity and clustering on fips
                      j=   34.87  Chi-sq( 30) p-value=0.2474
                      
                      2-step GMM J underidentification stats by regressor:
                      [omitted]
                      j=   33.78  Chi-sq( 30) p-value=0.2474 1.z#c.x [my variable of interest]

                      I still have this problem of the 2-step and 3-step not matching. The K-P underidentification test statistic has p-values of 0.24 for the model and my focal variable of interest, which would support the idea that the instruments are weak. I'm not sure how big of a problem that is, though I know weak instruments can yield unstable results.

                      I'm really optimistic that I have finally gotten close to a good model specification (with the limitation of somewhat weak identification), but if you have any feedback I sure would appreciate it! Thank you!
                      Last edited by Sandy Lovejoy; 25 Aug 2020, 13:30.

                      Comment


                      • #12
                        Your first gmmiv() set should be for model(diff). If there is no evidence of serial correlation, then using lagrange(0 0) for your second gmmiv() set produces stronger instruments, in line with the conventional specification of system GMM estimators. Try:
                        Code:
                        xtdpdgmm y L.y L2.y (x L.x)##(z) a b c d,
                        > gmmiv (L.y L2.y x L.x z a b c d, model(diff) lagrange(1 4) collapse)
                        > gmmiv (L.y L2.y x L.x z a b c d, model(level) diff lagrange(0 0) collapse)
                        > twostep vce(robust) teffects
                        If you worry about the difference between the two-step and three-step weighting matrix, try to replace the twostep option with the igmm option. Otherwise, for the beginning just ignore this difference. Most people just consider the two-step version of the overidentification test.

                        You can try to remove L.x as a regressor and see if it still passes the specification tests.
                        https://www.kripfganz.de/stata/

                        Comment


                        • #13
                          Originally posted by Sebastian Kripfganz View Post
                          If there is no evidence of serial correlation, then using lagrange(0 0) for your second gmmiv() set produces stronger instruments, in line with the conventional specification of system GMM estimators. Try:
                          Code:
                          xtdpdgmm y L.y L2.y (x L.x)##(z) a b c d,
                          > gmmiv (L.y L2.y x L.x z a b c d, model(diff) lagrange(1 4) collapse)
                          > gmmiv (L.y L2.y x L.x z a b c d, model(level) diff lagrange(0 0) collapse)
                          > twostep vce(robust) teffects
                          Thank you so much! This model specification passed the tests! My only concern is that I don't think I can really make a case that there is no serial correlation, since homicide rate and gun ownership rate would be theoretically expected to be quite serially auto-correlated.

                          If I don't make that assumption, should I make the lag limits for the level-GMM (1 4)? Or if I'm assuming they could be endogenous, should I make it (2 4)? I am thinking this below would be the similar model, without the assumption of no serial correlation:

                          Code:
                          xtdpdgmm y L.y L2.y (x L.x)##(z) a b c d,
                          > gmmiv (L.y L2.y x L.x z a b c d, model(diff) lagrange(1 4) collapse)
                          > gmmiv (L.y L2.y x L.x z a b c d, model(level) diff lagrange(1 4) collapse)
                          > twostep vce(robust) teffects
                          Is that correct? This (1 4) (1 4) model passes both the two-step and three-step Sargan-Hansen overidentification tests, so I hope that this model specification is justifiable.
                          Last edited by Sandy Lovejoy; 25 Aug 2020, 22:18.

                          Comment


                          • #14
                            The hope would be that the lagged dependent variables takes care of this serial correlation. If the model passes the Arellano-Bond serial correlation test, you should be fine.

                            If model(diff) lagrange(1 4) is valid for the first gmmiv() set, then model(level) diff lagrange(0 0) would be valid for the second gmmiv() set.
                            If you suspect remaining serial error correlation, then you need to adjust both lag ranges, e.g. model(diff) lagrange(2 4) for the first set and model(level) diff lagrange(1 1) for the second set.
                            https://www.kripfganz.de/stata/

                            Comment


                            • #15
                              Thank you so much. That makes a lot of sense, and I got one of those models you suggested to pass (almost all of) the tests.

                              I want to thank you again for your patience and generosity -- it is very kind of you to help out PhD students learning this method. Have a wonderful evening.

                              Comment

                              Working...
                              X