jungsee的个人博客分享 http://blog.sciencenet.cn/u/jungsee

博文

差分广义矩( DiffGMM) 和系统广义矩(SYSGMM)

已有 33738 次阅读 2015-3-23 13:04 |个人分类:文献分享|系统分类:论文交流




货币政策立场与银行风险承担_基于_省略_的实证研究_2000_2010_.pdf


交通基础设施投资与居民收入——来自中国农村的经验证据.pdf


11.docx




1. xtdpdsysstata10以后官方发布的命令,语法格式更为简洁;而xtabond2则是Roodman(2009)发布的个人编写的命令,语法格式较为繁复。

2. xtdpdsys可以通过pre()选项将部分解释变量设定为predetermined(前定变量),亦可通过endog()选项将部分解释变量设定为内生变量;而xtabond2则只能通过gmm()选项将部分解释变量设定为内生变量,并未能支持前定变量的设定;

3. xtdpdsys执行后无法直接报告sargan统计量和AR2统计量(需要进一步使用estat sarganestat abond 来报告这两个统计量),而xtabond2则可以,且该命令会同时报告hansen统计量。

xtabond2是默认把ivstyle里面的变量都取滞后项同时作为差分、水平方程的工具变量;xtdpdsys默认只用于差分方程。
并且,xtdpdsys将没有设定为内生或先决变量的都自动作为外生变量,将其滞后项用作工具变量估计差分方程; xtabond2中可以有一部分在前面的回归变量中列出,但既不列入gmmstyle,也不列入ivstyle,这样就不参与差分和水平方程的估计了(主要是一些滞后项)。
xtdpd
的灵活性基本跟xtabond2一样,但更加简洁,就是可以直接、分别地设定差分估计和水平估计中采用gmm形式(一个多列矩阵)和iv形式(一个包含自身滞后的列向量)的变量。

1最大的区别是,xtabond2将外生变量(iv中给出)的滞后项也作为了level equation的工具变量,而xtdpdsys不这么做。
通过在xtabond2中设置iv( 外生变量列 ,eq(d) )可以使两者一样。

2
)还有是工具变量矩阵的设定不同。这一点大部分不是专门研究计量理论的人可以忽略,xtabond2有一个h(#)设置,默认#3,而系统dpd用的是2,这是之前gaussox程序下延续下来的。
The h(#) option, which most users can safelyignore, controls the choice of H. h(1) sets H = I, for both difference andsystem GMM. For difference GMM, h(2) and h(3) coincide. They differ for systemGMM, however, with h(2) imitating DPD for Ox and h(3) being the xtabond2default



3
)另外,xtdpdsysxtabond2在差分方程的正交化处理之后,在常数项的对待上有不同,前者在在正交化之后又加上了常数项(差分过程本身会把常数项去掉)。下面几组命令的结果应当一致
// CASE #1- W
严格外生
xtdpdsys n w, two vce(robust)
xtabond2 n l.n w, gmm(l.n) iv(w, eq(dif)) h(2)two robust
//CASE #2- W
predetermined(弱外生)
xtdpdsys n, pre(w) two vce(robust)
xtabond2 n l.n w, gmm(l.n w) h(2) two robust
// CASE #3- W
内生
xtdpdsys n, endo(w) two vce(robust)
xtabond2 n l.n w, gmm(l.n l.w) h(2) two robust



关于两者是否都能做内生和先决变量区分,答案显然是两者都可以。
个人感觉xtabond2更加灵活,但手动性操作对原理的认识要求也就更高,相当于个手动模式的单反相机。

 

好像    xtabond2可以设定内生变量和前定变量。如果x是内生变量,GMM里面填写L.X如果x是前定变量,GMM里面就填写x 

这两个命令都可以用来做系统GMM,但xtabond2更加灵活一些和手动一些,作为官方命令的xtdpdsys更加简洁。
xtabond2
同样可以区分predeterminedendogenous变量。predetermined变量从一阶滞后开始就可以作为工具变量,而endogenous变量要从滞后二阶开始。所以先决变量直接加入gmmstyle,内生变量滞后一期加入gmmstyle
xtabond2
的作者有个论文How to do xtabondRoodman 2009),里面就提到了这一个。
If w is predetermined to not be strictlyexogenous, standard treatment is to use lags 1 and longer, GMM-style(gmmstyle(w)). And if w is endogenous, standard treatment is lags 2 and longer(gmmstyle(L.w)).

关于 predetermined变量如何理解,我想同一篇文章里的这句话说的也比较到位了:
Some regressors can be predetermined but notstrictly exogenous; that is, independent of current disturbances, someregressors can be influenced by past ones.The lagged dependent variable is anexample.
其中提示我们,动态面板中因变量的滞后项也属于predetermined。所以许多例子中gmmstyle中都有一个自变量的滞后项,再加上其他内生变量的滞后项,可以简写成L.(自变量内生因变量)。

xtabond2
中需要对外生变量做设定,回归时产生的是一列自身的滞后项做为工具变量,而xtdpdsys不需要专门设定外生变量。

 

clear

set more off

infile exp wks occ ind south smsa ms femunion ed blk lwage  ///

using "D:软件培训资料动态面板aa.txt"

drop in 1

describe

summarize

generate person=group(595)

bysort person: generate period=group(7)

* panel data definition

xtset person period

xtdes

xtsum

generate exp2=exp^2

local x1 exp exp2 wks occ ind south smsa msunion

local x2 ed blk fem

 

* panel data regression: y=lwage

* x1=[1 exp exp2 wks occ ind south smsa msunion],

* x2=[ed blk fem] (time-invariant regressors)

 

 

xtdpdsys lwage occ ind south smsa, lags(1)maxldep(3) vce(robust) ///

endogenous(ms union,lag(0,2))pre(wks,lag(1,2)) twostep

estimates store ABB1

 

 

xtdpdsys lwage occ ind south smsa, lags(2)maxldep(3) vce(robust)  ///

endogenous(ms union,lag(0,2)) pre(wks,lag(1,2))twostep

estimates store ABB2

 

 

xtdpdsys lwage occ ind south smsa, lags(3)maxldep(3) vce(robust)  ///

endogenous(ms union,lag(0,2))pre(wks,lag(1,2)) twostep

estimates store ABB3

 

 

estimates table ABB1 ABB2 ABB3, b se t p

 

* hypothesis testing

quietly xtdpdsys lwage occ ind south smsa,lags(2) maxldep(3)      ///

endogenous(ms union,lag(0,2))pre(wks,lag(1,2)) twostep artest(4)

estat abond   // test for autocorrelation

estat sargan  // test for IVoveridentification

 

 

xtabond2 df age age2  ed12  nwe12 perd2perd3 perd4 lnrtb3 ///

dna dnk dms dhrsw dhrsh dyu2, gmm(L.(lnrtb3dms dna dnk dfu dyu2 dhrsh dhrsw), lag(3) collapse) ///

iv(age age2  edCol edColp ednoHS)twostep robust  ///

noconstant small   orthogonal  art(3)

*直接复制help中的例子

use http://www.stata-press.com/data/r7/abdata.dta

xtabond2 n l.n l(0/1).(w k) yr1980-yr1984, gmm(l.n w k)iv(yr1980-yr1984, passthru) noleveleq small

xtabond2 n l.n l(0/1).(w k) yr1980-yr1984, gmm(l.n w k)iv(yr1980-yr1984, mz) robust twostep small h(2)

xtabond2 n l(1/2).n l(0/1).w l(0/2).(k ys) yr1980-yr1984, gmm(l.n w k)iv(yr1980-yr1984) robust twostep

small

* Next two are equivalent, assuming id is the panel identifier

ivreg2 n cap (w = k ys rec) [pw=_n], cluster(ind) orthog(rec)

xtabond2 n w cap [pw=_n], iv(cap k ys, eq(level)) iv(rec, eq(level))cluster(ind) h(1)

* Same for next two

regress n w k

xtabond2 n w k, iv(w k, eq(level)) small h(1)

* And next two, assuming xtabond updated since May 2004 with updatecommand.

xtabond n yr*, lags(1) pre(w, lags(1,.)) pre(k, endog) robust smallnoconstant

xtabond2 n L.n w L.w k yr*, gmm(L.(w n k)) iv(yr*) noleveleq robustsmall

* And next two

xtdpd n L.n L(0/1).(w k) yr1978-yr1984, dgmm(w k n) lgmm(w k n)liv(yr1978-yr1984) vce(robust) two hascons

xtabond2 n L.n L(0/1).(w k) yr1978-yr1984, gmm(L.(w k n))iv(yr1978-yr1984, eq(level)) h(2) robust twostep

* Three ways to reduce the instrument count

xtabond2 n L.n L(0/1).(w k) yr1978-yr1984, gmm(L.(w k n))iv(yr1978-yr1984, eq(level)) h(2) robust twostep pca

xtabond2 n L.n L(0/1).(w k) yr1978-yr1984, gmm(L.(w k n), collapse)iv(yr1978-yr1984, eq(level)) h(2) robust twostep

xtabond2 n L.n L(0/1).(w k) yr1978-yr1984, gmm(L.(w k n), lag(1 1))iv(yr1978-yr1984, eq(level)) h(2) robust twostep

 




https://wap.sciencenet.cn/blog-793574-876623.html

上一篇:STATA数据运行后——输出大全
下一篇:如何用stata做分年、分行业的回归
收藏 IP: 111.203.16.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-14 09:43

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部