[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"David Roodman" <DRoodman@CGDEV.ORG> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: RE: Already Differenced Variables in xtabond2 |

Date |
Wed, 9 Nov 2005 11:13:12 -0500 |

Jean Salvati is right that the problem is that there is no straightforward way in xtabond2 to prevent differencing of regressors in difference GMM-no direct analogy to the diff() option of xtabond. Seems to me the easiest thing to do is to undifference your variables before entering them in xtabond2-that is, create variables whose first differences are the variables you want to enter. Here's how to do it. If x is the already differenced variable, type: gen xc = x if L.x >= . replace xc = x + L.xc if L.xc < . D.xc will then equal c. ("c" for cumulative.) A couple things need explaining here. First missing (.) is like +infinity in most mathematical expressions. And other missing values (.a, .b., etc.) are greater than ".". That's why I do ">= ." and "< ." to determine if a value is missing or not. Second, the replace command is self-referential in that xc is on both the left and right side. Stata will do what you want here, first computing xc for one period, then moving to then next period and computing the next xc as a function of L.xc. Below is an example where I get nearly identical results with xtabond and xtabond2 using this. Before going to that let me mention a few other sources of difficulty in making xtabond and xtabond2. One is that xtabond treats the constant term as an already-differenced exogenous variable. It enters it straight in, which is equivalent to entering *time* as a regressor in your levels-equation model. xtabond2 differences the constant away. Second, in xtabond2 every variable ordinarily appears twice in the command line, once as a regressor, once as a basis for instrumenting. Third, the default in xtabond2 is system GMM. Use "noleveleq" in xtabond2 for difference GMM. Finally, last I checked there appeared to be a bug in xtabond that occurs when the time series for an individual is interrupted in the middle. It may be that when the core xtabond code (which is not public and not an .ado) tries to obtain lags of variables that are in fact missing from the regression sample, it jumps back farther to use available but incorrect values. Here's the example of a perfect match. There is another at the bottom of the xtabond2 help file, and another in bbest.do, an auxiliary file that comes with xtabond2. --David Roodman . clear . webuse abdata . gen kc = k if L.k >= . (891 missing values generated) . replace kc = k + L.kc if L.kc < . (891 real changes made) . xtabond n, diff(k) nocons robust Arellano-Bond dynamic panel-data estimation Number of obs = 751 Group variable (i): id Number of groups = 140 Wald chi2(.) = . Time variable (t): year Obs per group: min = 5 avg = 5.364286 max = 7 One-step results ------------------------------------------------------------------------------ | Robust D.n | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- n | LD. | 1.203445 .078324 15.36 0.000 1.049933 1.356957 k | -.004177 .0020447 -2.04 0.041 -.0081845 -.0001695 ------------------------------------------------------------------------------ Arellano-Bond test that average autocovariance in residuals of order 1 is 0: H0: no autocorrelation z = -2.48 Pr > z = 0.0131 Arellano-Bond test that average autocovariance in residuals of order 2 is 0: H0: no autocorrelation z = -1.39 Pr > z = 0.1652 . xtabond2 n L.n kc, iv(kc) gmm(L.n) noleveleq robust Building GMM instruments.. Estimating. Performing specification tests. Arellano-Bond dynamic panel-data estimation, one-step difference GMM results ------------------------------------------------------------------------------ Group variable: id Number of obs = 751 Time variable : year Number of groups = 140 Number of instruments = 29 Obs per group: min = 5 F(2, 139) = 136.10 avg = 5.36 Prob > F = 0.000 max = 7 ------------------------------------------------------------------------------ | Robust | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- n | L1. | 1.203445 .078324 15.36 0.000 1.049933 1.356957 kc | -.004177 .0020447 -2.04 0.041 -.0081845 -.0001695 ------------------------------------------------------------------------------ Hansen test of overid. restrictions: chi2(27) = 69.06 Prob > chi2 = 0.000 Arellano-Bond test for AR(1) in first differences: z = -2.48 Pr > z = 0.013 Arellano-Bond test for AR(2) in first differences: z = -1.39 Pr > z = 0.165 David Roodman Research Fellow Center for Global Development droodman@cgdev.org +1-202-416-0723 www.cgdev.org * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

- Prev by Date:
**Re: st: save results after .adjust** - Next by Date:
**st: -parplot- updated on SSC** - Previous by thread:
**st: RE: Already Differenced Variables in xtabond2** - Next by thread:
**RE: RE: st: RE: Already Differenced Variables in xtabond2** - Index(es):

© Copyright 1996–2014 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |