Dear Stata members
I am learning GMM (due to an urgent requirement, hence I am not getting sufficient time to know it in reasonable depth), and I have some doubts (which could be trivial for many in this forum) and I wish if someone could help me (at least by showing some related posts in this forum) with this issue. To give the back ground, let me display the results based on OLS which I did using userwritten command
In the above results, Firm_C1 to Firm_C9 are firm-level controls & Marco_C1 to Marco_C9 are macro-level (country-level controls like GDP, Unemployment, and Inflation). DEP_VAR is a firm_level outcome (say Return on assets) and KEY_INDEP_VAR is a country level variable monetary policy changes. There are 19 countries and panel identifier (id) is a firm-level unique code. I used firm fixed effects and year dummies.
Endogeneity issue was raised and I was asked to solve by GMM. Based on David Roodman (2009) I did some basic codes and here are my results
Coefficient of KEY_INDEP_VAR has changed and I am unable to find a reason for this change. In one post in Stata, I got to know that there is no need of employing firm-fixed effects and
1) Is that the case where I can assume safely in the above model firm-level fixed effects is controlled for?
2) First part of the code should be exactly as the OLS code right, xtabond2 DEP_VAR KEY_INDEP_VA i.year Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9 Macro_C1 Macro_C2 Macro_C3 is same as xtreg DEP_VAR KEY_INDEP_VA i.year Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9 Macro_C1 Macro_C2 Macro_C3 ?
3) Based on Roodman's reading, I think that strictly exogenous variables are only included in ivstyle. Based on my codes, I considered only year dummies (i.year) and macro level variables as strictly exogenous.
a) Is my approach correct?
b) Also, there are no lag options for variables in ivstyle, right?
4) Pre-determined and endogenous variables are entered in the gmm option, right? But since both are entered in gmm only, why to make a distinction as predetermined and endogenous
5) The lags I specified , say lag(2 10) are they arbitrary? Is it to be read as say Lags 2-10
I am extremely sorry for asking these many doubts but I feel that somewhere I must start and hence I ran the codes and thought of posing my questions to experts here.
I am flagging Sebastian Kripfganz because of his informative posts in this forum and if he could help me here
I am learning GMM (due to an urgent requirement, hence I am not getting sufficient time to know it in reasonable depth), and I have some doubts (which could be trivial for many in this forum) and I wish if someone could help me (at least by showing some related posts in this forum) with this issue. To give the back ground, let me display the results based on OLS which I did using userwritten command
Code:
-reghdfe-
Code:
reghdfe DEP_VAR KEY_INDEP_VAR ///
> Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9 ///
> Macro_C1 Macro_C2 Macro_C3 ///
> , absorb (id year) cluster (id)
(dropped 1318 singleton observations)
(MWFE estimator converged in 7 iterations)
HDFE Linear regression Number of obs = 136,205
Absorbing 2 HDFE groups F( 13, 14309) = 364.51
Statistics robust to heteroskedasticity Prob > F = 0.0000
R-squared = 0.4609
Adj R-squared = 0.3975
Within R-sq. = 0.0717
Number of clusters (id) = 14,310 Root MSE = 0.1899
(Std. err. adjusted for 14,310 clusters in id)
-------------------------------------------------------------------------------
| Robust
DEP_VAR | Coefficient std. err. t P>|t| [95% conf. interval]
--------------+----------------------------------------------------------------
KEY_INDEP_VAR | -.0077237 .0027593 -2.80 0.005 -.0131324 -.002315
Firm_C1 | .0003868 .0020274 0.19 0.849 -.0035872 .0043608
Firm_C2 | .0732736 .0083623 8.76 0.000 .0568824 .0896648
Firm_C3 | .0019558 .0026936 0.73 0.468 -.0033241 .0072357
Firm_C4 | .0604588 .0024701 24.48 0.000 .0556171 .0653004
Firm_C5 | -.0011158 .0004712 -2.37 0.018 -.0020394 -.0001923
Firm_C6 | 1.223736 .0219559 55.74 0.000 1.1807 1.266773
Firm_C7 | -.0534154 .0228991 -2.33 0.020 -.0983006 -.0085303
Firm_C8 | .0100359 .0084078 1.19 0.233 -.0064445 .0265163
Firm_C9 | -.0084562 .0053741 -1.57 0.116 -.0189901 .0020777
Macro_C1 | -.0375138 .0038234 -9.81 0.000 -.0450082 -.0300193
Macro_C2 | .0065364 .0002482 26.33 0.000 .0060498 .007023
Macro_C3 | .0024007 .0001674 14.34 0.000 .0020726 .0027289
_cons | -.2131295 .0356505 -5.98 0.000 -.2830091 -.14325
-------------------------------------------------------------------------------
Absorbed degrees of freedom:
-----------------------------------------------------+
Absorbed FE | Categories - Redundant = Num. Coefs |
-------------+---------------------------------------|
id | 14310 14310 0 *|
year | 19 0 19 |
-----------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation
Endogeneity issue was raised and I was asked to solve by GMM. Based on David Roodman (2009) I did some basic codes and here are my results
Code:
xtabond2 DEP_VAR KEY_INDEP_VA i.year Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 F
> irm_C9 Macro_C1 Macro_C2 Macro_C3, gmm(l.DEP_VAR, lag(1 3)) gmm (Firm_C1, lag (1 3)) gmm( Firm_C2 Fir
> m_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9, lag(2 10) collapse) iv(Macro_C1 Macro_C2 Macro_C
> 3 i.year) twostep robust
Favoring space over speed. To switch, type or click on mata: mata set matafavor speed, perm.
1999b.year dropped due to collinearity
2001.year dropped due to collinearity
2018.year dropped due to collinearity
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: id Number of obs = 137523
Time variable : year Number of groups = 15628
Number of instruments = 241 Obs per group: min = 1
Wald chi2(31) = 10157.69 avg = 8.80
Prob > chi2 = 0.000 max = 19
-------------------------------------------------------------------------------
| Corrected
DEP_VAR | Coefficient std. err. z P>|z| [95% conf. interval]
--------------+----------------------------------------------------------------
KEY_INDEP_VAR | .0495569 .0091046 5.44 0.000 .0317121 .0674016
|
year |
2000 | .1391199 .0133214 10.44 0.000 .1130104 .1652294
2002 | -.0174214 .0079028 -2.20 0.027 -.0329106 -.0019323
2003 | .0243558 .006567 3.71 0.000 .0114848 .0372269
2004 | .0471174 .0073238 6.43 0.000 .032763 .0614718
2005 | .0633432 .0079008 8.02 0.000 .0478578 .0788285
2006 | .0587114 .0074014 7.93 0.000 .0442049 .0732178
2007 | .0292609 .0068337 4.28 0.000 .0158671 .0426546
2008 | -.0151653 .0056269 -2.70 0.007 -.0261938 -.0041368
2009 | -.0139271 .0048216 -2.89 0.004 -.0233774 -.0044769
2010 | .0033373 .004372 0.76 0.445 -.0052317 .0119062
2011 | -.0008633 .0046948 -0.18 0.854 -.0100649 .0083383
2012 | .008641 .0037336 2.31 0.021 .0013233 .0159588
2013 | .0130211 .0036124 3.60 0.000 .0059411 .0201012
2014 | .026704 .0042533 6.28 0.000 .0183677 .0350403
2015 | .0127859 .0038573 3.31 0.001 .0052258 .020346
2016 | -.0074542 .002863 -2.60 0.009 -.0130655 -.0018428
2017 | -.014839 .0025782 -5.76 0.000 -.0198921 -.0097858
2019 | -.0223558 .0033719 -6.63 0.000 -.0289645 -.0157471
|
Firm_C1 | -.0330403 .0046483 -7.11 0.000 -.0421509 -.0239298
Firm_C2 | .1201259 .0337599 3.56 0.000 .0539578 .1862941
Firm_C3 | .0348483 .0076759 4.54 0.000 .0198039 .0498928
Firm_C4 | .1739604 .0120762 14.41 0.000 .1502915 .1976293
Firm_C5 | .0145557 .0021544 6.76 0.000 .0103333 .0187782
Firm_C6 | -.487628 .0792169 -6.16 0.000 -.6428902 -.3323659
Firm_C7 | .177308 .0640902 2.77 0.006 .0516936 .3029224
Firm_C8 | -.1239519 .0327534 -3.78 0.000 -.1881475 -.0597564
Firm_C9 | -.0431818 .0037204 -11.61 0.000 -.0504736 -.03589
Macro_C1 | .0380888 .0062416 6.10 0.000 .0258555 .0503221
Macro_C2 | .0047792 .0003157 15.14 0.000 .0041605 .0053979
Macro_C3 | -.0016251 .000144 -11.28 0.000 -.0019074 -.0013427
_cons | -.1112933 .0446202 -2.49 0.013 -.1987472 -.0238394
-------------------------------------------------------------------------------
Instruments for first differences equation
Standard
D.(Macro_C1 Macro_C2 Macro_C3 1999b.year 2000.year 2001.year 2002.year
2003.year 2004.year 2005.year 2006.year 2007.year 2008.year 2009.year
2010.year 2011.year 2012.year 2013.year 2014.year 2015.year 2016.year
2017.year 2018.year 2019.year)
GMM-type (missing=0, separate instruments for each period unless collapsed)
L(2/10).(Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9)
collapsed
L(1/3).Firm_C1
L(1/3).L.DEP_VAR
Instruments for levels equation
Standard
Macro_C1 Macro_C2 Macro_C3 1999b.year 2000.year 2001.year 2002.year
2003.year 2004.year 2005.year 2006.year 2007.year 2008.year 2009.year
2010.year 2011.year 2012.year 2013.year 2014.year 2015.year 2016.year
2017.year 2018.year 2019.year
_cons
GMM-type (missing=0, separate instruments for each period unless collapsed)
DL.(Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9)
collapsed
D.Firm_C1
D.L.DEP_VAR
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z = -47.48 Pr > z = 0.000
Arellano-Bond test for AR(2) in first differences: z = 7.26 Pr > z = 0.000
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(209) =2222.98 Prob > chi2 = 0.000
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(209) =1152.10 Prob > chi2 = 0.000
(Robust, but weakened by many instruments.)
Difference-in-Hansen tests of exogeneity of instrument subsets:
GMM instruments for levels
Hansen test excluding group: chi2(164) = 825.91 Prob > chi2 = 0.000
Difference (null H = exogenous): chi2(45) = 326.18 Prob > chi2 = 0.000
gmm(L.DEP_VAR, lag(1 3))
Hansen test excluding group: chi2(140) = 849.77 Prob > chi2 = 0.000
Difference (null H = exogenous): chi2(69) = 302.33 Prob > chi2 = 0.000
gmm(Firm_C1, lag(1 3))
Hansen test excluding group: chi2(139) = 860.39 Prob > chi2 = 0.000
Difference (null H = exogenous): chi2(70) = 291.71 Prob > chi2 = 0.000
gmm(Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9, collapse lag(2 10))
Hansen test excluding group: chi2(129) = 658.80 Prob > chi2 = 0.000
Difference (null H = exogenous): chi2(80) = 493.29 Prob > chi2 = 0.000
iv(Macro_C1 Macro_C2 Macro_C3 1999b.year 2000.year 2001.year 2002.year 2003.year 2004.year 2005.year 2
> 006.year 2007.year 2008.year 2009.year 2010.year 2011.year 2012.year 2013.year 2014.year 2015.year 201
> 6.year 2017.year 2018.year 2019.year)
Hansen test excluding group: chi2(188) =1034.39 Prob > chi2 = 0.000
Difference (null H = exogenous): chi2(21) = 117.71 Prob > chi2 = 0.000
Coefficient of KEY_INDEP_VAR has changed and I am unable to find a reason for this change. In one post in Stata, I got to know that there is no need of employing firm-fixed effects and
1) Is that the case where I can assume safely in the above model firm-level fixed effects is controlled for?
2) First part of the code should be exactly as the OLS code right, xtabond2 DEP_VAR KEY_INDEP_VA i.year Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9 Macro_C1 Macro_C2 Macro_C3 is same as xtreg DEP_VAR KEY_INDEP_VA i.year Firm_C1 Firm_C2 Firm_C3 Firm_C4 Firm_C5 Firm_C6 Firm_C7 Firm_C8 Firm_C9 Macro_C1 Macro_C2 Macro_C3 ?
3) Based on Roodman's reading, I think that strictly exogenous variables are only included in ivstyle. Based on my codes, I considered only year dummies (i.year) and macro level variables as strictly exogenous.
a) Is my approach correct?
b) Also, there are no lag options for variables in ivstyle, right?
4) Pre-determined and endogenous variables are entered in the gmm option, right? But since both are entered in gmm only, why to make a distinction as predetermined and endogenous
5) The lags I specified , say lag(2 10) are they arbitrary? Is it to be read as say Lags 2-10
I am extremely sorry for asking these many doubts but I feel that somewhere I must start and hence I ran the codes and thought of posing my questions to experts here.
I am flagging Sebastian Kripfganz because of his informative posts in this forum and if he could help me here

Comment