Source:
Dynamic Panel Data : IV and GMM Estimation with Stata (Panel)
xtabond cheat sheet
简介
动态面板数据模型,是指通过在静态面板数据模型中引入滞后被解释变量以反映动态滞后效应的模型。这种模型的特殊性在于被解释变量的动态滞后项与随机误差组成部分中的个体效应相关,从而造成估计的内生性。
也就是说在动态面板模型允许使用过去的可观测值,考虑了过去结果对当前结果的影响。而实际上许多经济学问题本质上都是动态的,其中一些经济模型表明,当前的行为依赖于过去的行为,例如就业模型和公司投资问题。
AR(1) 模型
基本设定
- 是一个的向量,由时间t上的样本中每个空间单位的被解释变量的一个观测值, 为其在时间上的滞后值的响应参数
- 是的外生解释变量矩阵,为其响应参数向量
- 是特定效应,且有
- 是服从 分布的干扰项,且有
这里就特定效应类型将模型分为两大类
固定效应模型(Fixed effect)
通过消去特定效应项得到
但是此时与相关,尽管是在是序列不相关的的情况下。这是因为与相关,后一项的均值包含了这一项,明显与是相关的。这可以看出固定效应模型的估计是有偏的。随机效应模型(Random effect )
若使用广义最小二乘法(GLS),同理可知,与是相关的。
因此,可以看出,对于一个动态面板数据模型来说,若使用GLS估计方法,不管是固定效应模型还是随机效应模型,它的估计都是有偏且不一致连续的。且偏误的阶数是,仅当时。但是当 很小,时可能会引起很大的偏误。
-
提出问题:为什么当 固定,时会出现偏误和不一致连续的情况?
- 首先考虑没有外生向量的模型:
假设,对于向量 我们在 时有观测值,
则固定效应模型的估计量为
将等式(3)代入等式(4)中,可以得到估计量的特征
等式(5)中,当 固定,的情况下,FE模型的估计值有偏且不一致。因为等式(5)右边最后一项的期望不为零,且在的情况下不收敛到零。Nickell (1981) 和 Hsia (2003) 曾提出过:因此,对于固定的 ,我们有不一致的估计量,不过这与无关,已经在估计过程过被去掉了。
这里的问题是被解释变量的动态滞后项与随机误差组成部分中的个体效应相关,如在等式(2)与(5)我们所遇到的问题,即与相关。但当时,等式(6)收敛到零,此时当 和时,的估计是一致的。
- 首先考虑没有外生向量的模型:
估计方法
IV
为了解决估计量不一致的问题,Anderson 和 Hsio (1981) 提出了工具变量估计(IV)。首先,我们考虑消去个体效应,对此,做差分得:
- 此处若使用最小二乘法(OSL)得到等式(7)的估计量是不一致的,尽管是在的情况下,这是因为和相关。
- 转换规范等式(7)给出一个IV估计的方法,例如,与相关,但与不相关,所以选取作为工具变量,给出了的一个IV估计:
对应的关于等式(8)的一致性条件为 注意这里是MA(1)
- Anderson 和 Hsio (1981) 又给出了另一个IV估计的方案,这里选择将作为工具变量。同理,得到等式(10)的一致性条件为 且只要不是自相关的,等式(8)和(11)的一致性都得到了保障。
可以看出,等式(10)构建工具变量时比等式(8)多引入了一个滞后项,这导致缺失了一期的样本数据。这就又提出了一个问题,我们究竟是选择等式(8)还是等式(10)的估计比较好?
而矩估计(MM)法则不需要考虑这个问题,MM估计可以统一所有的估计量且消去样本容量减少的缺点。
GMM
可得等式(9)的矩条件为
同理,等式(11)的矩条件为这两个IV估计值都在估计中附加了一个矩条件。但是,据我们所知,附加更多的矩条件则能增加估计值的效率。
据此,Arellano 和 Bond (1991) 提出可以通过开发附加矩来扩大工具的列表并且是工具的数量随着 t 变化。首先,固定T,这里考虑 T=4。
- t = 2 时,矩条件变为:
这意味着变量是有效的工具,因为它与高度相关而与不相关。 - t = 3 时,同理可得,矩条件为: 同时也满足
其中,与相关,而与不相关。 - t = 4 时,我们将得到三组矩条件
一直继续这么添加矩条件之后,有效的工具集合变为
而所有的这些矩条件可以作为广义矩估计(GMM)的一个框架。对于一般的样本大小 T,所有差分后的误差项可排成一个向量:
由工具变量排成的矩阵为:
矩阵的每一行都包含了给定时段所有有效工具。因此,所有矩条件的集合可写为:为了得到GMM估计,将等式(16)改写成
显然,矩条件的数量会增加未知参数的数量。
这里我们通过最小化由等式(17)所对应的条件表达的二次型来估计参数:
其中是定义的对称正定的权重矩阵。
然后,通过对等式(18)关于求微分并求解得到GMM估计量:
GMM估计并不强制要求关于个体与时间服从独立分布,但是需要注意的是,需要不存在自相关以保证矩条件有效。因此,在一个短面板(即T比较小),建议强制不存在自相关,并结合同方差性假设。
Alvarez 和 Arellano (2003) 表示,通常,GMM估计在的情况下仍然保持一致性。但是,对于的情况下,GMM估计和FE估计会很接近,这给我们估计方法提供了一个更具有吸引力的选择。
实际应用
Arellano和Bond ( 1991) 提出了一阶差分GMM (FD-GMM)估计方法,主要做法是用变量的水平滞后值作为其一阶差分项的工具变量。具体来说:
- 由我们上文所考虑的没有外生向量的模型(3)的水平方程,考虑它的差分方程
因为与相关联,所以将作为的工具变量。这种估计方法就是FD-GMM。
但是, Blundell和Bond (1998)曾指出,一阶差分GMM估计方法容易受到弱工具变量的影响而得到有偏的估计结果。即:
- 由模型(3)的水平方程可得
当接近1的时候,工具变量和外生变量的关系就会变的很弱,这就会产生“弱工具变量问题”。
为了克服弱工具变量的影响, Arellano和Bover (1995) 以及Blundell和Bond (1998)提出了另外一种更加有效的方法,即系统GMM (SYS-GMM)估计方法。其具体做法是将水平方程和差分方程结合起来进行估计,在这种估计方法中,滞后水平作为一阶差分的工具变量,而一阶差分又作为水平变量的工具变量。具体来说:
在上述FD-GMM估计中,可以看作是应用了矩条件,但是却有个矩条件被忽略了,
即:
而SYS-GMM则是考虑到了这一点,利用了更多的有效信息,使得估计不受接近1时的影响。
Stata 范例
- 我们可以使用
xtabond
命令来实现FD-GMM估计,这里我们使用数据abdata
. webuse abdata
. xtabond n L(0/2).(w k) yr1980-yr1984 year, vce(robust)
Arellano-Bond dynamic panel-data estimation Number of obs = 611
Group variable: id Number of groups = 140
Time variable: year
Obs per group:
min = 4
avg = 4.364286
max = 6
Number of instruments = 40 Wald chi2(13) = 1318.68
Prob > chi2 = 0.0000
One-step results
(Std. Err. adjusted for clustering on id)
------------------------------------------------------------------------------
| Robust
n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
n |
L1. | .6286618 .1161942 5.41 0.000 .4009254 .8563983
|
w |
--. | -.5104249 .1904292 -2.68 0.007 -.8836592 -.1371906
L1. | .2891446 .140946 2.05 0.040 .0128954 .5653937
L2. | -.0443653 .0768135 -0.58 0.564 -.194917 .1061865
|
k |
--. | .3556923 .0603274 5.90 0.000 .2374528 .4739318
L1. | -.0457102 .0699732 -0.65 0.514 -.1828552 .0914348
L2. | -.0619721 .0328589 -1.89 0.059 -.1263743 .0024301
|
yr1980 | -.0282422 .0166363 -1.70 0.090 -.0608488 .0043643
yr1981 | -.0694052 .028961 -2.40 0.017 -.1261677 -.0126426
yr1982 | -.0523678 .0423433 -1.24 0.216 -.1353591 .0306235
yr1983 | -.0256599 .0533747 -0.48 0.631 -.1302723 .0789525
yr1984 | -.0093229 .0696241 -0.13 0.893 -.1457837 .1271379
year | .0019575 .0119481 0.16 0.870 -.0214604 .0253754
_cons | -2.543221 23.97919 -0.11 0.916 -49.54158 44.45514
------------------------------------------------------------------------------
Instruments for differenced equation
GMM-type: L(2/.).n
Standard: D.w LD.w L2D.w D.k LD.k L2D.k D.yr1980 D.yr1981 D.yr1982
D.yr1983 D.yr1984 D.year
Instruments for level equation
Standard: _cons
- 下面用
xtdpdsys
命令来实现SYS-GMM估计
. xtdpdsys n L(0/2).(w k) yr1980-yr1984 year, vce(robust)
System dynamic panel-data estimation Number of obs = 751
Group variable: id Number of groups = 140
Time variable: year
Obs per group:
min = 5
avg = 5.364286
max = 7
Number of instruments = 47 Wald chi2(13) = 2579.96
Prob > chi2 = 0.0000
One-step results
------------------------------------------------------------------------------
| Robust
n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
n |
L1. | .8221535 .093387 8.80 0.000 .6391184 1.005189
|
w |
--. | -.5427935 .1881721 -2.88 0.004 -.911604 -.1739831
L1. | .3703602 .1656364 2.24 0.025 .0457189 .6950015
L2. | -.0726314 .0907148 -0.80 0.423 -.2504292 .1051664
|
k |
--. | .3638069 .0657524 5.53 0.000 .2349346 .4926792
L1. | -.1222996 .0701521 -1.74 0.081 -.2597951 .015196
L2. | -.0901355 .0344142 -2.62 0.009 -.1575862 -.0226849
|
yr1980 | -.0308622 .016946 -1.82 0.069 -.0640757 .0023512
yr1981 | -.0718417 .0293223 -2.45 0.014 -.1293123 -.014371
yr1982 | -.0384806 .0373631 -1.03 0.303 -.1117111 .0347498
yr1983 | -.0121768 .0498519 -0.24 0.807 -.1098847 .0855311
yr1984 | -.0050903 .0655011 -0.08 0.938 -.1334701 .1232895
year | .0058631 .0119867 0.49 0.625 -.0176304 .0293566
_cons | -10.59198 23.92087 -0.44 0.658 -57.47602 36.29207
------------------------------------------------------------------------------
Instruments for differenced equation
GMM-type: L(2/.).n
Standard: D.w LD.w L2D.w D.k LD.k L2D.k D.yr1980 D.yr1981 D.yr1982
D.yr1983 D.yr1984 D.year
Instruments for level equation
GMM-type: LD.n
Standard: _cons
可以看到工具变量的数量变多。
-
xtdpd
则是一种更加灵活的替代方法,它可以用比xtabond
和xtdpdsys
更复杂的结构来拟合在特殊误差和预定变量中具有低阶移动平均关联的模型。
假设检验
序列相关检验
可以看出 Arellano–Bond估计工具变量的设定的关键点在于
我们可以在 Stata 中使用estat abond
命令来测试这些条件。
从本质上来说,一般未观测到的的差分项应与其因变量的第二期滞后和之后的滞后项都无关。如果不是这样,我们又回到了一开始的问题,内生性。所以我们主要关心的是有没有2阶或者更高阶的序列相关性。
下面我们用estat bond
命令来测试我们上述的例子:
. estat abond, artests(4)
Dynamic panel-data estimation Number of obs = 751
Group variable: id Number of groups = 140
Time variable: year
Obs per group:
min = 5
avg = 5.364286
max = 7
Number of instruments = 47 Wald chi2(13) = 2579.96
Prob > chi2 = 0.0000
One-step results
(Std. Err. adjusted for clustering on id)
------------------------------------------------------------------------------
| Robust
n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
n |
L1. | .8221535 .093387 8.80 0.000 .6391184 1.005189
|
w |
--. | -.5427935 .1881721 -2.88 0.004 -.911604 -.1739831
L1. | .3703602 .1656364 2.24 0.025 .0457189 .6950015
L2. | -.0726314 .0907148 -0.80 0.423 -.2504292 .1051664
|
k |
--. | .3638069 .0657524 5.53 0.000 .2349346 .4926792
L1. | -.1222996 .0701521 -1.74 0.081 -.2597951 .015196
L2. | -.0901355 .0344142 -2.62 0.009 -.1575862 -.0226849
|
yr1980 | -.0308622 .016946 -1.82 0.069 -.0640757 .0023512
yr1981 | -.0718417 .0293223 -2.45 0.014 -.1293123 -.014371
yr1982 | -.0384806 .0373631 -1.03 0.303 -.1117111 .0347498
yr1983 | -.0121768 .0498519 -0.24 0.807 -.1098847 .0855311
yr1984 | -.0050903 .0655011 -0.08 0.938 -.1334701 .1232895
year | .0058631 .0119867 0.49 0.625 -.0176304 .0293566
_cons | -10.59198 23.92087 -0.44 0.658 -57.47602 36.29207
------------------------------------------------------------------------------
Instruments for differenced equation
GMM-type: L(2/.).n
Standard: D.w LD.w L2D.w D.k LD.k L2D.k D.yr1980 D.yr1981 D.yr1982
D.yr1983 D.yr1984 D.year
Instruments for level equation
GMM-type: LD.n
Standard: _cons
Arellano-Bond test for zero autocorrelation in first-differenced errors
+-----------------------+
|Order | z Prob > z|
|------+----------------|
| 1 |-4.6414 0.0000 |
| 2 |-1.0572 0.2904 |
| 3 |-.19492 0.8455 |
| 4 | .04472 0.9643 |
+-----------------------+
H0: no autocorrelation
可以看到的是,我们可以拒绝一阶序列相关的原假设,但是不能拒绝2、3、4阶序列相关的原假设。所以原模型是合理的。
过度识别检验(estat overid)
检验工具变量是否是与干扰项相关,也就是工具变量是否为外生变量。
原假设是:所有工具变量都是外生。
其中包含 hansen 检验和 sargan 检验,可以用 Stata 中的xtabond2
命令实现。
Stata 范例
-
xtabond
命令实现了 Arellano 和 Bond Roodman在1991年所提出的一阶差分矩估计法(FD-GMM),此时它的矩条件是将因变量的滞后和外生变量的一阶差分作为一阶差分方程的工具。 -
xtdpdsys
实现了Arellano、Bover/Blundell 和 Bond在1998年提出的系统 GMM 估计(SYS-GMM) ,它使用了xtabond
的矩条件,同时又将因变量滞后第一差分作为水平方程的工具。 -
xtdpd
则是一种更加灵活的替代方法,它可以用比xtabond
和xtdpdsys
更复杂的结构来拟合在特殊误差和预定变量中具有低阶移动平均关联的模型。 - 后估计工具允许您在一阶差分残差中测试序列相关性,并测试过度识别限制的有效性。
例子:
基于Layard和Nickell(1986)的工作,Arellano和Bond(1991)将劳动力需求的动态模型拟合到位于英国的一个具有不平衡面板的公司上。首先,我们根据 工资(wages)、资本存量(capital stock)、行业产出(industry output)、年度假人(year dummies) 以及 一个时间趋势(a time trend )对 就业率(employment) 进行建模,其中包括就业,工资和资本存量的滞后。我们将使用xtabond
命令
. webuse abdata
. xtabond n L(0/2).(w k) yr1980-yr1984 year, vce(robust)
Arellano-Bond dynamic panel-data estimation Number of obs = 611
Group variable: id Number of groups = 140
Time variable: year
Obs per group:
min = 4
avg = 4.364286
max = 6
Number of instruments = 40 Wald chi2(13) = 1318.68
Prob > chi2 = 0.0000
One-step results
(Std. Err. adjusted for clustering on id)
------------------------------------------------------------------------------
| Robust
n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
n |
L1. | .6286618 .1161942 5.41 0.000 .4009254 .8563983
|
w |
--. | -.5104249 .1904292 -2.68 0.007 -.8836592 -.1371906
L1. | .2891446 .140946 2.05 0.040 .0128954 .5653937
L2. | -.0443653 .0768135 -0.58 0.564 -.194917 .1061865
|
k |
--. | .3556923 .0603274 5.90 0.000 .2374528 .4739318
L1. | -.0457102 .0699732 -0.65 0.514 -.1828552 .0914348
L2. | -.0619721 .0328589 -1.89 0.059 -.1263743 .0024301
|
yr1980 | -.0282422 .0166363 -1.70 0.090 -.0608488 .0043643
yr1981 | -.0694052 .028961 -2.40 0.017 -.1261677 -.0126426
yr1982 | -.0523678 .0423433 -1.24 0.216 -.1353591 .0306235
yr1983 | -.0256599 .0533747 -0.48 0.631 -.1302723 .0789525
yr1984 | -.0093229 .0696241 -0.13 0.893 -.1457837 .1271379
year | .0019575 .0119481 0.16 0.870 -.0214604 .0253754
_cons | -2.543221 23.97919 -0.11 0.916 -49.54158 44.45514
------------------------------------------------------------------------------
Instruments for differenced equation
GMM-type: L(2/.).n
Standard: D.w LD.w L2D.w D.k LD.k L2D.k D.yr1980 D.yr1981 D.yr1982
D.yr1983 D.yr1984 D.year
Instruments for level equation
Standard: _cons
由于我们的回归模型中包含一个n的滞后,xtabond
使用滞后2期和back作为工具。外生变量的差分也可以作为工具。
这里,我们使用xtdpdsys
来重新定义模型
. xtdpdsys n L(0/2).(w k) yr1980-yr1984 year, vce(robust)
System dynamic panel-data estimation Number of obs = 751
Group variable: id Number of groups = 140
Time variable: year
Obs per group:
min = 5
avg = 5.364286
max = 7
Number of instruments = 47 Wald chi2(13) = 2579.96
Prob > chi2 = 0.0000
One-step results
------------------------------------------------------------------------------
| Robust
n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
n |
L1. | .8221535 .093387 8.80 0.000 .6391184 1.005189
|
w |
--. | -.5427935 .1881721 -2.88 0.004 -.911604 -.1739831
L1. | .3703602 .1656364 2.24 0.025 .0457189 .6950015
L2. | -.0726314 .0907148 -0.80 0.423 -.2504292 .1051664
|
k |
--. | .3638069 .0657524 5.53 0.000 .2349346 .4926792
L1. | -.1222996 .0701521 -1.74 0.081 -.2597951 .015196
L2. | -.0901355 .0344142 -2.62 0.009 -.1575862 -.0226849
|
yr1980 | -.0308622 .016946 -1.82 0.069 -.0640757 .0023512
yr1981 | -.0718417 .0293223 -2.45 0.014 -.1293123 -.014371
yr1982 | -.0384806 .0373631 -1.03 0.303 -.1117111 .0347498
yr1983 | -.0121768 .0498519 -0.24 0.807 -.1098847 .0855311
yr1984 | -.0050903 .0655011 -0.08 0.938 -.1334701 .1232895
year | .0058631 .0119867 0.49 0.625 -.0176304 .0293566
_cons | -10.59198 23.92087 -0.44 0.658 -57.47602 36.29207
------------------------------------------------------------------------------
Instruments for differenced equation
GMM-type: L(2/.).n
Standard: D.w LD.w L2D.w D.k LD.k L2D.k D.yr1980 D.yr1981 D.yr1982
D.yr1983 D.yr1984 D.year
Instruments for level equation
GMM-type: LD.n
Standard: _cons
比较这两个命令输出的页脚说明了这两个估计器之间的关键区别。xtdpdsys
将n的滞后差也作为工具纳入水平方程,而xtabond
没有。xtdpdsys
的工具变量变多了,但是模型的标准误降低了。
这些GMM估计量的矩条件只有在特征误差不存在序列相关性的情况下才有效。由于白噪声的第一个差异必然是自相关的,我们只需要关注第二个和更高的自相关。我们可以使用estat abond
测试自相关:
. estat abond, artests(4)
Dynamic panel-data estimation Number of obs = 751
Group variable: id Number of groups = 140
Time variable: year
Obs per group:
min = 5
avg = 5.364286
max = 7
Number of instruments = 47 Wald chi2(13) = 2579.96
Prob > chi2 = 0.0000
One-step results
(Std. Err. adjusted for clustering on id)
------------------------------------------------------------------------------
| Robust
n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
n |
L1. | .8221535 .093387 8.80 0.000 .6391184 1.005189
|
w |
--. | -.5427935 .1881721 -2.88 0.004 -.911604 -.1739831
L1. | .3703602 .1656364 2.24 0.025 .0457189 .6950015
L2. | -.0726314 .0907148 -0.80 0.423 -.2504292 .1051664
|
k |
--. | .3638069 .0657524 5.53 0.000 .2349346 .4926792
L1. | -.1222996 .0701521 -1.74 0.081 -.2597951 .015196
L2. | -.0901355 .0344142 -2.62 0.009 -.1575862 -.0226849
|
yr1980 | -.0308622 .016946 -1.82 0.069 -.0640757 .0023512
yr1981 | -.0718417 .0293223 -2.45 0.014 -.1293123 -.014371
yr1982 | -.0384806 .0373631 -1.03 0.303 -.1117111 .0347498
yr1983 | -.0121768 .0498519 -0.24 0.807 -.1098847 .0855311
yr1984 | -.0050903 .0655011 -0.08 0.938 -.1334701 .1232895
year | .0058631 .0119867 0.49 0.625 -.0176304 .0293566
_cons | -10.59198 23.92087 -0.44 0.658 -57.47602 36.29207
------------------------------------------------------------------------------
Instruments for differenced equation
GMM-type: L(2/.).n
Standard: D.w LD.w L2D.w D.k LD.k L2D.k D.yr1980 D.yr1981 D.yr1982
D.yr1983 D.yr1984 D.year
Instruments for level equation
GMM-type: LD.n
Standard: _cons
Arellano-Bond test for zero autocorrelation in first-differenced errors
+-----------------------+
|Order | z Prob > z|
|------+----------------|
| 1 |-4.6414 0.0000 |
| 2 |-1.0572 0.2904 |
| 3 |-.19492 0.8455 |
| 4 | .04472 0.9643 |
+-----------------------+
H0: no autocorrelation
参考文献:
1、 Dynamic Panel Data : IV and GMM Estimation with Stata (Panel)
2、 xtabond cheat sheet
3、
重现 Arollano and Bond (1991) FD-GMM 结果
clear all
set mem 32m
set matsize 800
use "http://www.stata-press.com/data/r7/abdata.dta"
- 设置变量,其一阶差分是年度虚拟变量和常数项。
这个步骤一般不是必需的,但需要完全模仿DPD,因为它在FD-GMM中也是需要直接输入时间虚拟和常数项。
forvalues y = 1979/1984 {
gen yr`y'c = year>=`y'
}
gen cons = year
运行结果
- a1
xtabond2 n L(0/1).(l.n w) l(0/2).(k ys) yr198?c cons, gmm(L.n) iv(L(0/1).w l(0/2).(k ys) yr198?c cons) noleveleq noconstant robust
输出结果为:
Dynamic panel-data estimation, one-step difference GMM
------------------------------------------------------------------------------
Group variable: id Number of obs = 611
Time variable : year Number of groups = 140
Number of instruments = 41 Obs per group: min = 4
Wald chi2(16) = 1727.45 avg = 4.36
Prob > chi2 = 0.000 max = 6
------------------------------------------------------------------------------
| Robust
n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
n |
L1. | .6862261 .1445943 4.75 0.000 .4028266 .9696257
L2. | -.0853582 .0560155 -1.52 0.128 -.1951467 .0244302
|
w |
--. | -.6078208 .1782055 -3.41 0.001 -.9570972 -.2585445
L1. | .3926237 .1679931 2.34 0.019 .0633632 .7218842
|
k |
--. | .3568456 .0590203 6.05 0.000 .241168 .4725233
L1. | -.0580012 .0731797 -0.79 0.428 -.2014308 .0854284
L2. | -.0199475 .0327126 -0.61 0.542 -.0840631 .0441681
|
ys |
--. | .6085073 .1725313 3.53 0.000 .2703522 .9466624
L1. | -.7111651 .2317163 -3.07 0.002 -1.165321 -.2570095
L2. | .1057969 .1412021 0.75 0.454 -.1709542 .382548
|
yr1980c | .0029062 .0158028 0.18 0.854 -.0280667 .0338791
yr1981c | -.043344 .0169961 -2.55 0.011 -.0766557 -.0100323
yr1982c | -.024839 .0202692 -1.23 0.220 -.0645658 .0148878
yr1983c | -.0038161 .0219426 -0.17 0.862 -.0468227 .0391905
yr1984c | .0040626 .0218975 0.19 0.853 -.0388558 .046981
cons | .0095545 .0102896 0.93 0.353 -.0106127 .0297217
------------------------------------------------------------------------------
Instruments for first differences equation
Standard
D.(w L.w k L.k L2.k ys L.ys L2.ys yr1980c yr1981c yr1982c yr1983c yr1984c
cons)
GMM-type (missing=0, separate instruments for each period unless collapsed)
L(1/8).L.n
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z = -3.60 Pr > z = 0.000
Arellano-Bond test for AR(2) in first differences: z = -0.52 Pr > z = 0.606
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(25) = 67.59 Prob > chi2 = 0.000
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(25) = 31.38 Prob > chi2 = 0.177
(Robust, but weakened by many instruments.)
Difference-in-Hansen tests of exogeneity of instrument subsets:
iv(w L.w k L.k L2.k ys L.ys L2.ys yr1980c yr1981c yr1982c yr1983c yr1984c cons)
Hansen test excluding group: chi2(11) = 12.01 Prob > chi2 = 0.363
Difference (null H = exogenous): chi2(14) = 19.37 Prob > chi2 = 0.151
- a2
xtabond2 n L(0/1).(l.n w) l(0/2).(k ys) yr198?c cons, gmm(L.n) iv(L(0/1).w l(0/2).(k ys) yr198?c cons) noleveleq noconstant two
输出结果为:
Dynamic panel-data estimation, two-step difference GMM
------------------------------------------------------------------------------
Group variable: id Number of obs = 611
Time variable : year Number of groups = 140
Number of instruments = 41 Obs per group: min = 4
Wald chi2(16) = 2216.93 avg = 4.36
Prob > chi2 = 0.000 max = 6
------------------------------------------------------------------------------
n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
n |
L1. | .6287089 .0904543 6.95 0.000 .4514216 .8059961
L2. | -.0651882 .0265009 -2.46 0.014 -.117129 -.0132474
|
w |
--. | -.5257597 .0537692 -9.78 0.000 -.6311453 -.420374
L1. | .3112899 .0940116 3.31 0.001 .1270305 .4955492
|
k |
--. | .2783619 .0449083 6.20 0.000 .1903432 .3663807
L1. | .0140994 .0528046 0.27 0.789 -.0893957 .1175946
L2. | -.0402484 .0258038 -1.56 0.119 -.0908229 .010326
|
ys |
--. | .5919243 .1162114 5.09 0.000 .3641542 .8196943
L1. | -.5659863 .1396738 -4.05 0.000 -.8397419 -.2922306
L2. | .1005433 .1126749 0.89 0.372 -.1202955 .321382
|
yr1980c | .0006378 .0127959 0.05 0.960 -.0244417 .0257172
yr1981c | -.0556422 .0143097 -3.89 0.000 -.0836888 -.0275956
yr1982c | -.0209736 .0163224 -1.28 0.199 -.0529648 .0110177
yr1983c | .0019072 .014625 0.13 0.896 -.0267574 .0305718
yr1984c | -.0165899 .0153035 -1.08 0.278 -.0465842 .0134045
cons | .0112155 .0077507 1.45 0.148 -.0039756 .0264066
------------------------------------------------------------------------------
Warning: Uncorrected two-step standard errors are unreliable.
Instruments for first differences equation
Standard
D.(w L.w k L.k L2.k ys L.ys L2.ys yr1980c yr1981c yr1982c yr1983c yr1984c
cons)
GMM-type (missing=0, separate instruments for each period unless collapsed)
L(1/8).L.n
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z = -3.00 Pr > z = 0.003
Arellano-Bond test for AR(2) in first differences: z = -0.42 Pr > z = 0.678
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(25) = 67.59 Prob > chi2 = 0.000
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(25) = 31.38 Prob > chi2 = 0.177
(Robust, but weakened by many instruments.)
Difference-in-Hansen tests of exogeneity of instrument subsets:
iv(w L.w k L.k L2.k ys L.ys L2.ys yr1980c yr1981c yr1982c yr1983c yr1984c cons)
Hansen test excluding group: chi2(11) = 12.01 Prob > chi2 = 0.363
Difference (null H = exogenous): chi2(14) = 19.37 Prob > chi2 = 0.151
- b
xtabond2 n L(0/1).(l.n ys w) k yr198?c cons, gmm(L.n) iv(L(0/1).(ys w) k yr198?c cons) noleveleq noconstant two
输出结果为:
Dynamic panel-data estimation, two-step difference GMM
------------------------------------------------------------------------------
Group variable: id Number of obs = 611
Time variable : year Number of groups = 140
Number of instruments = 38 Obs per group: min = 4
Wald chi2(13) = 1603.26 avg = 4.36
Prob > chi2 = 0.000 max = 6
------------------------------------------------------------------------------
n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
n |
L1. | .4741506 .0853032 5.56 0.000 .3069594 .6413417
L2. | -.0529677 .0272843 -1.94 0.052 -.106444 .0005087
|
ys |
--. | .609776 .1085238 5.62 0.000 .3970732 .8224788
L1. | -.4463736 .1248148 -3.58 0.000 -.6910061 -.201741
|
w |
--. | -.5132049 .0493453 -10.40 0.000 -.60992 -.4164898
L1. | .22464 .0800628 2.81 0.005 .0677198 .3815601
|
k | .2927232 .0394626 7.42 0.000 .215378 .3700684
yr1980c | .0036333 .0127335 0.29 0.775 -.0213239 .0285905
yr1981c | -.050962 .0137101 -3.72 0.000 -.0778334 -.0240907
yr1982c | -.0321491 .0139863 -2.30 0.022 -.0595618 -.0047364
yr1983c | -.0123558 .0128418 -0.96 0.336 -.0375252 .0128135
yr1984c | -.0207296 .0136789 -1.52 0.130 -.0475398 .0060806
cons | .010509 .0072515 1.45 0.147 -.0037036 .0247216
------------------------------------------------------------------------------
Warning: Uncorrected two-step standard errors are unreliable.
Instruments for first differences equation
Standard
D.(ys L.ys w L.w k yr1980c yr1981c yr1982c yr1983c yr1984c cons)
GMM-type (missing=0, separate instruments for each period unless collapsed)
L(1/8).L.n
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z = -2.43 Pr > z = 0.015
Arellano-Bond test for AR(2) in first differences: z = -0.33 Pr > z = 0.739
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(25) = 75.46 Prob > chi2 = 0.000
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(25) = 30.11 Prob > chi2 = 0.220
(Robust, but weakened by many instruments.)
Difference-in-Hansen tests of exogeneity of instrument subsets:
iv(ys L.ys w L.w k yr1980c yr1981c yr1982c yr1983c yr1984c cons)
Hansen test excluding group: chi2(14) = 13.33 Prob > chi2 = 0.501
Difference (null H = exogenous): chi2(11) = 16.78 Prob > chi2 = 0.115
- c
可用数据集缺少销售和库存信息,因此这里必须使用别的工具。 该回归完美地复制了 DPD 在 Ox包中 abest3.out 的结果
xtabond2 n L(0/1).(l.n ys w) k yr198?c cons, gmm(L.n) gmm(w k, lag(2 3)) iv(L(0/1).ys yr198?c cons) noleveleq noconstant two
输出结果为:
Dynamic panel-data estimation, two-step difference GMM
------------------------------------------------------------------------------
Group variable: id Number of obs = 611
Time variable : year Number of groups = 140
Number of instruments = 59 Obs per group: min = 4
Wald chi2(13) = 2668.33 avg = 4.36
Prob > chi2 = 0.000 max = 6
------------------------------------------------------------------------------
n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
n |
L1. | .8074308 .0491071 16.44 0.000 .7111827 .9036789
L2. | -.1134945 .0228508 -4.97 0.000 -.1582813 -.0687076
|
ys |
--. | .8599923 .1097787 7.83 0.000 .6448299 1.075155
L1. | -.8632569 .1101426 -7.84 0.000 -1.079132 -.6473814
|
w |
--. | -.5686242 .0598841 -9.50 0.000 -.6859949 -.4512536
L1. | .640707 .0672002 9.53 0.000 .508997 .772417
|
k | .1833987 .0567488 3.23 0.001 .0721731 .2946243
yr1980c | .0095269 .0112312 0.85 0.396 -.0124858 .0315397
yr1981c | -.0557186 .0117042 -4.76 0.000 -.0786584 -.0327788
yr1982c | -.0558586 .0122055 -4.58 0.000 -.0797809 -.0319362
yr1983c | -.0304113 .0133729 -2.27 0.023 -.0566217 -.0042009
yr1984c | -.0238496 .0137584 -1.73 0.083 -.0508155 .0031163
cons | .0162529 .006453 2.52 0.012 .0036053 .0289005
------------------------------------------------------------------------------
Warning: Uncorrected two-step standard errors are unreliable.
Instruments for first differences equation
Standard
D.(ys L.ys yr1980c yr1981c yr1982c yr1983c yr1984c cons)
GMM-type (missing=0, separate instruments for each period unless collapsed)
L(2/3).(w k)
L(1/8).L.n
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z = -4.07 Pr > z = 0.000
Arellano-Bond test for AR(2) in first differences: z = -0.68 Pr > z = 0.498
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(46) = 98.75 Prob > chi2 = 0.000
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(46) = 58.71 Prob > chi2 = 0.099
(Robust, but weakened by many instruments.)
Difference-in-Hansen tests of exogeneity of instrument subsets:
gmm(L.n, lag(1 .))
Hansen test excluding group: chi2(19) = 19.11 Prob > chi2 = 0.450
Difference (null H = exogenous): chi2(27) = 39.60 Prob > chi2 = 0.056
gmm(w k, lag(2 3))
Hansen test excluding group: chi2(22) = 22.98 Prob > chi2 = 0.403
Difference (null H = exogenous): chi2(24) = 35.73 Prob > chi2 = 0.058
iv(ys L.ys yr1980c yr1981c yr1982c yr1983c yr1984c cons)
Hansen test excluding group: chi2(38) = 40.24 Prob > chi2 = 0.371
Difference (null H = exogenous): chi2(8) = 18.47 Prob > chi2 = 0.018
重现 SYS-GMM 结果
clear all
set matsize 800
use "http://www.stata-press.com/data/r7/abdata.dta"
- 设置变量,其一阶差分是年度虚拟变量和常数项。
这个步骤一般不是必需的,但需要完全模仿DPD,因为它在FD-GMM中也是需要直接输入时间虚拟和常数项。
forvalues y = 1979/1984 {
gen yr`y'c = year>=`y'
}
gen cons = year
运行结果
- FD-GMM
- a
xtabond2 n L.n L(0/1).(w k) yr*c cons, gmm(L.(w k n)) iv(yr*c cons) noleveleq noconstant robust
输出结果
Dynamic panel-data estimation, one-step difference GMM
------------------------------------------------------------------------------
Group variable: id Number of obs = 751
Time variable : year Number of groups = 140
Number of instruments = 91 Obs per group: min = 5
Wald chi2(12) = 1163.33 avg = 5.36
Prob > chi2 = 0.000 max = 7
------------------------------------------------------------------------------
| Robust
n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
n |
L1. | .7074701 .0841788 8.40 0.000 .5424827 .8724576
|
w |
--. | -.7087965 .117102 -6.05 0.000 -.9383122 -.4792809
L1. | .5000149 .1113282 4.49 0.000 .2818157 .7182141
|
k |
--. | .4659776 .101044 4.61 0.000 .267935 .6640203
L1. | -.2151309 .0858525 -2.51 0.012 -.3833987 -.0468631
|
yr1979c | .0021095 .0177521 0.12 0.905 -.0326839 .0369028
yr1980c | -.0265559 .0194641 -1.36 0.172 -.0647048 .0115931
yr1981c | -.0326771 .0232915 -1.40 0.161 -.0783275 .0129733
yr1982c | .0223882 .0254598 0.88 0.379 -.0275121 .0722885
yr1983c | .0188752 .0235881 0.80 0.424 -.0273567 .0651071
yr1984c | .010743 .0269194 0.40 0.690 -.0420179 .063504
cons | .0057636 .0166077 0.35 0.729 -.0267868 .038314
------------------------------------------------------------------------------
Instruments for first differences equation
Standard
D.(yr1979c yr1980c yr1981c yr1982c yr1983c yr1984c cons)
GMM-type (missing=0, separate instruments for each period unless collapsed)
L(1/8).(L.w L.k L.n)
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z = -5.60 Pr > z = 0.000
Arellano-Bond test for AR(2) in first differences: z = -0.14 Pr > z = 0.891
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(79) = 125.19 Prob > chi2 = 0.001
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(79) = 88.80 Prob > chi2 = 0.211
(Robust, but weakened by many instruments.)
Difference-in-Hansen tests of exogeneity of instrument subsets:
iv(yr1979c yr1980c yr1981c yr1982c yr1983c yr1984c cons)
Hansen test excluding group: chi2(72) = 79.36 Prob > chi2 = 0.258
Difference (null H = exogenous): chi2(7) = 9.44 Prob > chi2 = 0.223
- b
xtabond2 n L.n L(0/1).(w k) yr*c cons, gmm(L.(w k n)) iv(yr*c cons) noleveleq robust twostep
输出结果为:
Dynamic panel-data estimation, two-step difference GMM
------------------------------------------------------------------------------
Group variable: id Number of obs = 751
Time variable : year Number of groups = 140
Number of instruments = 91 Obs per group: min = 5
Wald chi2(12) = 909.34 avg = 5.36
Prob > chi2 = 0.000 max = 7
------------------------------------------------------------------------------
| Corrected
n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
n |
L1. | .6787867 .0890781 7.62 0.000 .5041969 .8533765
|
w |
--. | -.7198296 .1221408 -5.89 0.000 -.9592211 -.4804381
L1. | .4626914 .1134755 4.08 0.000 .2402835 .6850992
|
k |
--. | .4539046 .1275537 3.56 0.000 .2039038 .7039053
L1. | -.1914923 .1044671 -1.83 0.067 -.396244 .0132595
|
yr1979c | -.0023874 .0174565 -0.14 0.891 -.0366015 .0318267
yr1980c | -.0258997 .0187008 -1.38 0.166 -.0625525 .0107532
yr1981c | -.0317158 .0239383 -1.32 0.185 -.078634 .0152024
yr1982c | .0226915 .0268209 0.85 0.398 -.0298764 .0752594
yr1983c | .0246047 .0257232 0.96 0.339 -.0258117 .0750211
yr1984c | .0105049 .0271836 0.39 0.699 -.0427738 .0637837
cons | .0052583 .0156783 0.34 0.737 -.0254706 .0359872
------------------------------------------------------------------------------
Instruments for first differences equation
Standard
D.(yr1979c yr1980c yr1981c yr1982c yr1983c yr1984c cons)
GMM-type (missing=0, separate instruments for each period unless collapsed)
L(1/8).(L.w L.k L.n)
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z = -4.46 Pr > z = 0.000
Arellano-Bond test for AR(2) in first differences: z = -0.17 Pr > z = 0.866
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(79) = 125.19 Prob > chi2 = 0.001
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(79) = 88.80 Prob > chi2 = 0.211
(Robust, but weakened by many instruments.)
Difference-in-Hansen tests of exogeneity of instrument subsets:
iv(yr1979c yr1980c yr1981c yr1982c yr1983c yr1984c cons)
Hansen test excluding group: chi2(72) = 79.36 Prob > chi2 = 0.258
Difference (null H = exogenous): chi2(7) = 9.44 Prob > chi2 = 0.223
-
SYS-GMM
eq(level)
选项通常也不是必需的,但需要完美的模仿。
同样,dpds2
是一个未记录的选项,模拟在DPD中one-step GMM的错误,使误差方差的点估计值加倍(sig2)并影响Sargan和AR()统计量。
dpds2
仅用于演示xtabond2
完全匹配DPD的能力。
- a
xtabond2 n L.n L(0/1).(w k) yr1978-yr1984, gmm(L.n, split) gmm(L.(w k)) iv(yr1978-yr1984, eq(level)) h(2) dpds2 robust
输出结果
Dynamic panel-data estimation, one-step system GMM
------------------------------------------------------------------------------
Group variable: id Number of obs = 891
Time variable : year Number of groups = 140
Number of instruments = 113 Obs per group: min = 6
Wald chi2(12) = 4921.25 avg = 6.36
Prob > chi2 = 0.000 max = 8
------------------------------------------------------------------------------
| Robust
n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
n |
L1. | .8714137 .0440549 19.78 0.000 .7850676 .9577597
|
w |
--. | -.7810899 .1159218 -6.74 0.000 -1.008292 -.5538873
L1. | .5120738 .1675084 3.06 0.002 .1837634 .8403843
|
k |
--. | .4688295 .0706695 6.63 0.000 .3303199 .6073391
L1. | -.3559805 .0718965 -4.95 0.000 -.496895 -.2150659
|
yr1978 | .0047266 .02076 0.23 0.820 -.0359621 .0454154
yr1979 | .0193132 .0245036 0.79 0.431 -.028713 .0673394
yr1980 | .0014647 .0247206 0.06 0.953 -.0469868 .0499163
yr1981 | -.0211725 .029662 -0.71 0.475 -.0793089 .0369639
yr1982 | .0148305 .0274198 0.54 0.589 -.0389113 .0685723
yr1983 | .0310377 .0255244 1.22 0.224 -.0189891 .0810646
yr1984 | .0201427 .0314874 0.64 0.522 -.0415714 .0818568
_cons | .9994287 .3899577 2.56 0.010 .2351257 1.763732
------------------------------------------------------------------------------
Instruments for first differences equation
GMM-type (missing=0, separate instruments for each period unless collapsed)
L(1/8).(L.w L.k)
L(1/8).L.n
Instruments for levels equation
Standard
yr1978 yr1979 yr1980 yr1981 yr1982 yr1983 yr1984
_cons
GMM-type (missing=0, separate instruments for each period unless collapsed)
D.(L.w L.k)
D.L.n
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z = -5.98 Pr > z = 0.000
Arellano-Bond test for AR(2) in first differences: z = -0.17 Pr > z = 0.867
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(100) = 157.41 Prob > chi2 = 0.000
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(100) = 111.59 Prob > chi2 = 0.201
(Robust, but weakened by many instruments.)
Difference-in-Hansen tests of exogeneity of instrument subsets:
GMM instruments for levels
Hansen test excluding group: chi2(79) = 88.15 Prob > chi2 = 0.225
Difference (null H = exogenous): chi2(21) = 23.43 Prob > chi2 = 0.321
gmm(L.n, eq(diff) lag(1 8))
Hansen test excluding group: chi2(72) = 85.96 Prob > chi2 = 0.125
Difference (null H = exogenous): chi2(28) = 25.63 Prob > chi2 = 0.593
gmm(L.n, eq(diff) lag(1 8)) eq(level) lag(0 0))
Hansen test excluding group: chi2(93) = 106.68 Prob > chi2 = 0.157
Difference (null H = exogenous): chi2(7) = 4.91 Prob > chi2 = 0.671
gmm(L.w L.k, lag(1 .))
Hansen test excluding group: chi2(30) = 43.22 Prob > chi2 = 0.056
Difference (null H = exogenous): chi2(70) = 68.37 Prob > chi2 = 0.533
iv(yr1978 yr1979 yr1980 yr1981 yr1982 yr1983 yr1984, eq(level))
Hansen test excluding group: chi2(93) = 109.91 Prob > chi2 = 0.111
Difference (null H = exogenous): chi2(7) = 1.68 Prob > chi2 = 0.976
- b
xtabond2 n L.n L(0/1).(w k) yr1978-yr1984, gmm(L.n, split) gmm(L.(w k)) iv(yr1978-yr1984, eq(level)) h(2) robust twostep
输出结果为:
Dynamic panel-data estimation, two-step system GMM
------------------------------------------------------------------------------
Group variable: id Number of obs = 891
Time variable : year Number of groups = 140
Number of instruments = 113 Obs per group: min = 6
Wald chi2(12) = 5912.36 avg = 6.36
Prob > chi2 = 0.000 max = 8
------------------------------------------------------------------------------
| Corrected
n | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
n |
L1. | .872881 .0452841 19.28 0.000 .7841259 .9616362
|
w |
--. | -.7797449 .1165601 -6.69 0.000 -1.008199 -.5512913
L1. | .5268032 .1620827 3.25 0.001 .2091269 .8444795
|
k |
--. | .4700773 .0798591 5.89 0.000 .3135562 .6265983
L1. | -.3576081 .0800305 -4.47 0.000 -.514465 -.2007512
|
yr1978 | .0058018 .0197099 0.29 0.768 -.0328288 .0444325
yr1979 | .0188977 .0227673 0.83 0.407 -.0257254 .0635207
yr1980 | .0028196 .0240708 0.12 0.907 -.0443583 .0499976
yr1981 | -.0200226 .0274419 -0.73 0.466 -.0738078 .0337625
yr1982 | .0152802 .0233063 0.66 0.512 -.0303992 .0609597
yr1983 | .031731 .0234974 1.35 0.177 -.0143231 .0777852
yr1984 | .0224206 .0310743 0.72 0.471 -.038484 .0833251
_cons | .9484881 .3775501 2.51 0.012 .2085035 1.688473
------------------------------------------------------------------------------
Instruments for first differences equation
GMM-type (missing=0, separate instruments for each period unless collapsed)
L(1/8).(L.w L.k)
L(1/8).L.n
Instruments for levels equation
Standard
yr1978 yr1979 yr1980 yr1981 yr1982 yr1983 yr1984
_cons
GMM-type (missing=0, separate instruments for each period unless collapsed)
D.(L.w L.k)
D.L.n
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z = -5.81 Pr > z = 0.000
Arellano-Bond test for AR(2) in first differences: z = -0.15 Pr > z = 0.883
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(100) = 157.41 Prob > chi2 = 0.000
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(100) = 111.59 Prob > chi2 = 0.201
(Robust, but weakened by many instruments.)
Difference-in-Hansen tests of exogeneity of instrument subsets:
GMM instruments for levels
Hansen test excluding group: chi2(79) = 88.15 Prob > chi2 = 0.225
Difference (null H = exogenous): chi2(21) = 23.43 Prob > chi2 = 0.321
gmm(L.n, eq(diff) lag(1 8))
Hansen test excluding group: chi2(72) = 85.96 Prob > chi2 = 0.125
Difference (null H = exogenous): chi2(28) = 25.63 Prob > chi2 = 0.593
gmm(L.n, eq(diff) lag(1 8)) eq(level) lag(0 0))
Hansen test excluding group: chi2(93) = 106.68 Prob > chi2 = 0.157
Difference (null H = exogenous): chi2(7) = 4.91 Prob > chi2 = 0.671
gmm(L.w L.k, lag(1 .))
Hansen test excluding group: chi2(30) = 43.22 Prob > chi2 = 0.056
Difference (null H = exogenous): chi2(70) = 68.37 Prob > chi2 = 0.533
iv(yr1978 yr1979 yr1980 yr1981 yr1982 yr1983 yr1984, eq(level))
Hansen test excluding group: chi2(93) = 109.91 Prob > chi2 = 0.111
Difference (null H = exogenous): chi2(7) = 1.68 Prob > chi2 = 0.976
重现 Greene 书中结果
重现 Greene, Econometric Analysis, 5th ed. p. 554例子
这里需要加载数据
并使用infile
语句提取文件
clear all
set mem 32m
set matsize 800
infile id year expend revenue grants using h:\macros\T7987.asc, clear
tsset id year
输出:
panel variable: id (strongly balanced)
time variable: year, 1979 to 1987
delta: 1 unit
运行结果
- 无设置年度虚拟变量
xi: xtabond2 expend l(1/3).(expend revenue grants) i.year, gmm(l.expend) iv(i.year) noleveleq twostep h(1)
输出结果为:
Dynamic panel-data estimation, two-step difference GMM
------------------------------------------------------------------------------
Group variable: id Number of obs = 1325
Time variable : year Number of groups = 265
Number of instruments = 30 Obs per group: min = 5
Wald chi2(17) = 796.67 avg = 5.00
Prob > chi2 = 0.000 max = 5
------------------------------------------------------------------------------
expend | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
expend |
L1. | 1.154936 .3440941 3.36 0.001 .4805244 1.829348
L2. | -.0376625 .2267605 -0.17 0.868 -.482105 .40678
L3. | -.5644067 .2179554 -2.59 0.010 -.9915915 -.137222
|
revenue |
L1. | -1.238006 .3617064 -3.42 0.001 -1.946938 -.5290747
L2. | .0770075 .2717902 0.28 0.777 -.4556915 .6097065
L3. | .6497806 .2693003 2.41 0.016 .1219617 1.177599
|
grants |
L1. | .0163122 .824194 0.02 0.984 -1.599078 1.631703
L2. | 1.553793 .7584145 2.05 0.040 .0673281 3.040258
L3. | 1.789179 .6929651 2.58 0.010 .4309924 3.147366
|
_Iyear_1980 | 0 (omitted)
_Iyear_1981 | 0 (omitted)
_Iyear_1982 | 0 (omitted)
_Iyear_1983 | -.0036579 .0002969 -12.32 0.000 -.0042399 -.0030759
_Iyear_1984 | -.0041546 .0005716 -7.27 0.000 -.0052748 -.0030343
_Iyear_1985 | -.0037737 .0006463 -5.84 0.000 -.0050404 -.0025071
_Iyear_1986 | -.003459 .0007194 -4.81 0.000 -.0048689 -.0020491
_Iyear_1987 | -.0025902 .0006666 -3.89 0.000 -.0038968 -.0012837
------------------------------------------------------------------------------
Warning: Uncorrected two-step standard errors are unreliable.
Instruments for first differences equation
Standard
D.(_Iyear_1980 _Iyear_1981 _Iyear_1982 _Iyear_1983 _Iyear_1984 _Iyear_1985
_Iyear_1986 _Iyear_1987)
GMM-type (missing=0, separate instruments for each period unless collapsed)
L(1/8).L.expend
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z = -2.98 Pr > z = 0.003
Arellano-Bond test for AR(2) in first differences: z = -2.26 Pr > z = 0.024
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(13) = 39.24 Prob > chi2 = 0.000
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(13) = 22.83 Prob > chi2 = 0.044
(Robust, but weakened by many instruments.)
Difference-in-Hansen tests of exogeneity of instrument subsets:
iv(_Iyear_1980 _Iyear_1981 _Iyear_1982 _Iyear_1983 _Iyear_1984 _Iyear_1985 _Iyear_1986 _Iyear_1987)
Hansen test excluding group: chi2(8) = 7.82 Prob > chi2 = 0.451
Difference (null H = exogenous): chi2(5) = 15.01 Prob > chi2 = 0.010
- 为了完美匹配,设置一阶差分为年度虚拟变量
forvalues y=1980/1987 {
gen yr`y'c = year>=`y'
}
xtabond2 expend l(1/3).(expend revenue grants) yr*c, gmm(l.expend) iv(yr*c) noleveleq twostep h(1)
输出结果为:
Dynamic panel-data estimation, two-step difference GMM
------------------------------------------------------------------------------
Group variable: id Number of obs = 1325
Time variable : year Number of groups = 265
Number of instruments = 30 Obs per group: min = 5
Wald chi2(17) = 796.67 avg = 5.00
Prob > chi2 = 0.000 max = 5
------------------------------------------------------------------------------
expend | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
expend |
L1. | 1.154936 .3440941 3.36 0.001 .4805244 1.829348
L2. | -.0376625 .2267605 -0.17 0.868 -.482105 .40678
L3. | -.5644067 .2179554 -2.59 0.010 -.9915915 -.137222
|
revenue |
L1. | -1.238006 .3617064 -3.42 0.001 -1.946938 -.5290747
L2. | .0770075 .2717902 0.28 0.777 -.4556915 .6097065
L3. | .6497806 .2693003 2.41 0.016 .1219617 1.177599
|
grants |
L1. | .0163122 .824194 0.02 0.984 -1.599078 1.631703
L2. | 1.553793 .7584145 2.05 0.040 .0673281 3.040258
L3. | 1.789179 .6929651 2.58 0.010 .4309924 3.147366
|
yr1980c | 0 (omitted)
yr1981c | 0 (omitted)
yr1982c | 0 (omitted)
yr1983c | -.0036579 .0002969 -12.32 0.000 -.0042399 -.0030759
yr1984c | -.0004967 .0004128 -1.20 0.229 -.0013057 .0003123
yr1985c | .0003809 .0003094 1.23 0.218 -.0002255 .0009872
yr1986c | .0003147 .0003282 0.96 0.338 -.0003286 .000958
yr1987c | .0008688 .000148 5.87 0.000 .0005788 .0011588
------------------------------------------------------------------------------
Warning: Uncorrected two-step standard errors are unreliable.
Instruments for first differences equation
Standard
D.(yr1980c yr1981c yr1982c yr1983c yr1984c yr1985c yr1986c yr1987c)
GMM-type (missing=0, separate instruments for each period unless collapsed)
L(1/8).L.expend
------------------------------------------------------------------------------
Arellano-Bond test for AR(1) in first differences: z = -2.98 Pr > z = 0.003
Arellano-Bond test for AR(2) in first differences: z = -2.26 Pr > z = 0.024
------------------------------------------------------------------------------
Sargan test of overid. restrictions: chi2(13) = 39.24 Prob > chi2 = 0.000
(Not robust, but not weakened by many instruments.)
Hansen test of overid. restrictions: chi2(13) = 22.83 Prob > chi2 = 0.044
(Robust, but weakened by many instruments.)
Difference-in-Hansen tests of exogeneity of instrument subsets:
iv(yr1980c yr1981c yr1982c yr1983c yr1984c yr1985c yr1986c yr1987c)
Hansen test excluding group: chi2(8) = 7.82 Prob > chi2 = 0.451
Difference (null H = exogenous): chi2(5) = 15.01 Prob > chi2 = 0.010