Code:
net install xtdpdgmm, from(http://www.kripfganz.de/stata) replace
Thanks to Tiyo Ardiyono for reporting this problem.
net install xtdpdgmm, from(http://www.kripfganz.de/stata) replace
adoupdate xtdpdgmm, update
xtdpdgmm yield_mtha L.yield_mtha L2.yield_mtha rs_gdd_s2 rs_hdd_s2 rs_precip_s2, /// > model(diff) gmm(yield_mtha yield_dev, lag(3 .)) iv(rs_gdd_s2 rs_hdd_s2 rs_precip_s2, model(mdev)) two coll vce(r) Generalized method of moments estimation Fitting full model: Step 1 f(b) = .61599272 Step 2 f(b) = .7763858 Group variable: code_muni Number of obs = 12798 Time variable: year Number of groups = 474 Moment conditions: linear = 56 Obs per group: min = 27 nonlinear = 0 avg = 27 total = 56 max = 27 (Std. Err. adjusted for 474 clusters in code_muni) ------------------------------------------------------------------------------ | WC-Robust yield_mtha | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yield_mtha | L1. | .3454116 .047806 7.23 0.000 .2517135 .4391097 L2. | .2802068 .0349527 8.02 0.000 .2117008 .3487128 | rs_gdd_s2 | .0898764 .0793811 1.13 0.258 -.0657077 .2454606 rs_hdd_s2 | -2.144849 1.132075 -1.89 0.058 -4.363676 .073978 rs_precip_s2 | .1919315 .0210945 9.10 0.000 .1505871 .233276 _cons | .0627011 .178586 0.35 0.726 -.2873209 .4127232 ------------------------------------------------------------------------------ Instruments corresponding to the linear moment conditions: 1, model(diff): L3.yield_mtha L4.yield_mtha L5.yield_mtha L6.yield_mtha L7.yield_mtha L8.yield_mtha L9.yield_mtha L10.yield_mtha L11.yield_mtha L12.yield_mtha L13.yield_mtha L14.yield_mtha L15.yield_mtha L16.yield_mtha L17.yield_mtha L18.yield_mtha L19.yield_mtha L20.yield_mtha L21.yield_mtha L22.yield_mtha L23.yield_mtha L24.yield_mtha L25.yield_mtha L26.yield_mtha L27.yield_mtha L28.yield_mtha L3.yield_dev L4.yield_dev L5.yield_dev L6.yield_dev L7.yield_dev L8.yield_dev L9.yield_dev L10.yield_dev L11.yield_dev L12.yield_dev L13.yield_dev L14.yield_dev L15.yield_dev L16.yield_dev L17.yield_dev L18.yield_dev L19.yield_dev L20.yield_dev L21.yield_dev L22.yield_dev L23.yield_dev L24.yield_dev L25.yield_dev L26.yield_dev L27.yield_dev L28.yield_dev 2, model(mdev): rs_gdd_s2 rs_hdd_s2 rs_precip_s2 3, model(level): _cons . . estat serial, ar(1/3) Arellano-Bond test for autocorrelation of the first-differenced residuals H0: no autocorrelation of order 1: z = -8.8835 Prob > |z| = 0.0000 H0: no autocorrelation of order 2: z = 1.4192 Prob > |z| = 0.1559 H0: no autocorrelation of order 3: z = -3.3863 Prob > |z| = 0.0007 . estat overid Sargan-Hansen test of the overidentifying restrictions H0: overidentifying restrictions are valid 2-step moment functions, 2-step weighting matrix chi2(50) = 368.0069 Prob > chi2 = 0.0000 2-step moment functions, 3-step weighting matrix chi2(50) = 375.7389 Prob > chi2 = 0.0000
. areg yield_mtha L.yield_mtha L2.yield_mtha rs_gdd_s2 rs_hdd_s2 rs_precip_s2, absorb (code_muni) vce(cluster code_muni) Linear regression, absorbing indicators Number of obs = 12,798 F( 5, 473) = 353.32 Prob > F = 0.0000 R-squared = 0.4831 Adj R-squared = 0.4631 Root MSE = 0.4588 (Std. Err. adjusted for 474 clusters in code_muni) ------------------------------------------------------------------------------ | Robust yield_mtha | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- yield_mtha | L1. | .3292273 .0200585 16.41 0.000 .2898126 .3686421 L2. | .2575985 .0157955 16.31 0.000 .2265606 .2886365 | rs_gdd_s2 | .0939887 .0570919 1.65 0.100 -.0181964 .2061737 rs_hdd_s2 | -2.253687 .7521274 -3.00 0.003 -3.731612 -.7757632 rs_precip_s2 | .1822983 .0145616 12.52 0.000 .1536849 .2109116 _cons | .128067 .1301362 0.98 0.326 -.1276496 .3837836 -------------+---------------------------------------------------------------- code_muni | absorbed (474 categories)
xtdpdgmm yield_mtha L.yield_mtha rs_gdd_s2 rs_hdd_s2 rs_precip_s2, /// model(diff) gmm(yield_mtha, lag(2 .)) gmm(rs_gdd_s2 rs_hdd_s2 rs_precip_s2, lag(. .)) note: standard errors may not be valid Generalized method of moments estimation Fitting full model: Step 1 f(b) = 3.3141562 Group variable: code_muni Number of obs = 13272 Time variable: year Number of groups = 474 Moment conditions: linear = 2728 Obs per group: min = 28 nonlinear = 0 avg = 28 total = 2728 max = 28 ------------------------------------------------------------------------------ yield_mtha | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yield_mtha | L1. | .4519066 .0089698 50.38 0.000 .4343261 .469487 | rs_gdd_s2 | .1722979 .0518055 3.33 0.001 .070761 .2738348 rs_hdd_s2 | -1.925162 .496409 -3.88 0.000 -2.898106 -.9522184 rs_precip_s2 | .158965 .0150132 10.59 0.000 .1295397 .1883903 _cons | .1510277 .1209611 1.25 0.212 -.0860518 .3881071 ------------------------------------------------------------------------------ Instruments corresponding to the linear moment conditions: 1, model(diff): 1992:L2.yield_mtha 1993:L2.yield_mtha 1994:L2.yield_mtha 1995:L2.yield_mtha 1996:L2.yield_mtha 1997:L2.yield_mtha 1998:L2.yield_mtha 1999:L2.yield_mtha 2000:L2.yield_mtha 2001:L2.yield_mtha 2002:L2.yield_mtha 2003:L2.yield_mtha 2004:L2.yield_mtha 2005:L2.yield_mtha 2006:L2.yield_mtha 2007:L2.yield_mtha 2008:L2.yield_mtha 2009:L2.yield_mtha 2010:L2.yield_mtha 2011:L2.yield_mtha ....... ....... .......
estat serial, ar(1/3) Arellano-Bond test for autocorrelation of the first-differenced residuals H0: no autocorrelation of order 1: z = -50.3692 Prob > |z| = 0.0000 H0: no autocorrelation of order 2: z = 23.5852 Prob > |z| = 0.0000 H0: no autocorrelation of order 3: z = -13.4781 Prob > |z| = 0.0000
net install xtdpdgmm, from(http://www.kripfganz.de/stata/) replace
xtdpdgmm pntbt L.pntbt ob_agre subnormal inadpf log_decapu log_pib log_iasc log_tarid, /// gmmiv(L.pntbt, lag(2 2) m(d) collapse) /// gmmiv(L.pntbt, lag(1 1) m(l) diff collapse) /// gmmiv(log_decapu, lag(2 2) m(d) collapse) /// gmmiv(log_decapu, lag(1 1) m(l) diff collapse) /// gmmiv(log_tarid, lag(2 2) m(d) collapse) /// gmmiv(log_tarid, lag(1 1) m(l) diff collapse) /// gmmiv(ob_agre subnormal inadpf log_pib log_iasc, lag(1 1) m(d) collapse) /// gmmiv(ob_agre subnormal inadpf log_pib log_iasc, lag(1 1) m(l) diff collapse) /// twostep vce(r) overid
xtdpdgmm pntbt L.pntbt ob_agre subnormal inadpf log_decapu log_pib log_iasc log_tarid, /// gmmiv(L.pntbt, lag(2 2) m(d) collapse) /// gmmiv(L.pntbt, lag(2 2) m(l) diff collapse) /// gmmiv(log_decapu, lag(2 2) m(d) collapse) /// gmmiv(log_decapu, lag(3 3) m(l) diff collapse) /// gmmiv(log_tarid, lag(2 2) m(d) collapse) /// gmmiv(log_tarid, lag(2 2) m(l) diff collapse) /// gmmiv(ob_agre subnormal inadpf log_pib log_iasc, lag(0 1) m(d) collapse) /// gmmiv(ob_agre subnormal inadpf log_pib log_iasc, lag(0 1) m(l) collapse) /// twostep vce(r) overid
Group variable: id Number of obs = 721 Time variable: ano Number of groups = 61 Moment conditions: linear = 27 Obs per group: min = 8 nonlinear = 0 avg = 11.81967 total = 27 max = 12 (Std. Err. adjusted for 61 clusters in id) ------------------------------------------------------------------------------ | WC-Robust pntbt | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- pntbt | L1. | .8545485 .0980974 8.71 0.000 .6622812 1.046816 | ob_agre | .0000241 .0002129 0.11 0.910 -.0003931 .0004414 subnormal | .2545236 .1650646 1.54 0.123 -.0689971 .5780442 inadpf | .0712857 .2658358 0.27 0.789 -.4497428 .5923142 log_decapu | .0202332 .0179756 1.13 0.260 -.0149983 .0554647 log_pib | .0086632 .008496 1.02 0.308 -.0079886 .025315 log_iasc | -.0108519 .0179764 -0.60 0.546 -.0460851 .0243813 log_tarid | .0352162 .0273752 1.29 0.198 -.0184383 .0888706 _cons | -.2797855 .2705651 -1.03 0.301 -.8100833 .2505124 ------------------------------------------------------------------------------
estat serial estat overid estat overid, difference
estat serial Arellano-Bond test for autocorrelation of the first-differenced residuals H0: no autocorrelation of order 1: z = -3.2453 Prob > |z| = 0.0012 H0: no autocorrelation of order 2: z = 1.5184 Prob > |z| = 0.1289 . estat overid Sargan-Hansen test of the overidentifying restrictions H0: overidentifying restrictions are valid 2-step moment functions, 2-step weighting matrix chi2(18) = 24.4723 Prob > chi2 = 0.1402 2-step moment functions, 3-step weighting matrix chi2(18) = 30.4614 Prob > chi2 = 0.0332 . 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(diff) | 24.4438 17 0.1079 | 0.0286 1 0.8658 2, model(level) | 24.4721 17 0.1072 | 0.0002 1 0.9884 3, model(diff) | 22.0325 17 0.1835 | 2.4398 1 0.1183 4, model(level) | 24.4103 17 0.1087 | 0.0620 1 0.8033 5, model(diff) | 22.2540 17 0.1751 | 2.2183 1 0.1364 6, model(level) | 24.4709 17 0.1072 | 0.0014 1 0.9700 7, model(diff) | 15.6926 8 0.0470 | 8.7797 10 0.5531 8, model(level) | 8.6499 8 0.3727 | 15.8224 10 0.1048 model(diff) | 8.0584 5 0.1530 | 16.4139 13 0.2275 model(level) | 8.0584 5 0.1530 | 16.4139 13 0.2275
Leave a comment: