十分抱歉,这两天较忙,所以现在才回复你的帖子。下面是我的答复:
* 该文件的目的在于说明,shaoshuai521 采用我建议的两种方法之所以得到了不同的结果
* 是因为没有注意到 xtgls 命令背后的基本假设,即,如果选择 p(c) 选项,则必须满足 T>=N.
* 在对数据进行简单处理,并满足该假设后,我建议的两种方法是等价的。
[-下载数据和清晰版结果-]
在线查看结果方法:点击压缩包,进入,打开 shao_hlog.html 文件即可。
* =================stata codes======================
cd D:\stata9\ado\personal\others
cap log close
log using shao, text replace
use "D:\stata9\ado\personal\others\shao.dta", clear
tsset p year
qui tab p, gen(dump)
drop dump1
*===============Part I=========shaoshuai521's results========
*-> shaoshuai521's original results
* here, T<N, so it not feasible to use the option `panels(c)'
* we can see that three province dummies are dropped
* this leads to the difference between the two methods.
qui xtgls y x1-x7 dump*, panels(correlated) corr(ar1)
est store gls
preserve
xtdata, fe clear
list p year y x1 in 1/10
qui xtgls y x1-x7, panels(correlated) corr(ar1)
est store xtdata_gls
restore
est table *gls, b(%6.3f) se(%6.4f)
* Comment: the fact that T<N make the differnece between these two methods
*===============Part II========Arlion's results=========
* now, we drop three provinces, so that T>=N
preserve
drop if province <4
drop dump2-dump4
* method_1-revisit
qui xtgls y x1-x7 dump*, panels(correlated) corr(ar1)
est store gls_a
* method_2-revisit
xtdata, fe clear
list p year y x1 in 1/10
qui xtgls y x1-x7, panels(correlated) corr(ar1)
est store xtdata_gls_a
est table *gls_a, b(%6.3f) se(%6.4f)
restore
* Comment: now, the same results got from these two methods.
*===============Part III========The correct way to estimate shaoshuai521's model=========
qui xtscc y x1-x7,fe
est store xtscc
qui xtreg y x1-x7,fe
est store fe
qui xtreg y x1-x7,fe robust
est store fe_r
qui xtgls y x1-x7, p(h) corr(ar1)
est store gls_h_ar
est table xtscc fe fe_r gls_h_ar, b(%6.3f) se(%6.4f)
* Comment:
* (1) the results got from xtgls is seriouly different from those got form xtreg or xtscc
* (2) xtreg,fe robust consider only het
* (3) xtscc,fe consider both het, ar, and cross-scetional correlation.
* Moreover, I sugguset you to drop x1, because x1 is seriouly correlated to other regressors
pwcorr y x*, star(0.01)
* we can see that, x1 is correlated with x2-x6 at 1% significant level.
log close
* ====================results=======================
----------------------------------------------------------------------------------------------------------
log: D:\stata9\ado\personal\others\shao.log
log type: text
opened on: 26 Sep 2007, 09:58:31
. use "D:\stata9\ado\personal\others\shao.dta", clear
.
. tsset p year
panel variable: province (strongly balanced)
time variable: year, 1997 to 2005
. qui tab p, gen(dump)
. drop dump1
.
. *===============Part I=========shaoshuai521's results========
. *-> shaoshuai521's original results
. * here, T<N, so it not feasible to use the option `panels(c)'
. * we can see that three province dummies are dropped
. * this leads to the difference between the two methods.
. qui xtgls y x1-x7 dump*, panels(correlated) corr(ar1)
. est store gls
.
. preserve
. xtdata, fe clear
. list p year y x1 in 1/10
+---------------------------------------+
| province year y x1 |
|---------------------------------------|
1. | 1 1997 5.523884 8.105545 |
2. | 1 1998 5.423883 8.216499 |
3. | 1 1999 3.723884 8.298578 |
4. | 1 2000 5.823884 8.37939 |
5. | 1 2001 6.023884 8.483179 |
|---------------------------------------|
6. | 1 2002 8.723884 8.58737 |
7. | 1 2003 13.62388 8.710558 |
8. | 1 2004 16.12388 8.917546 |
9. | 1 2005 19.32388 9.157933 |
10. | 2 1997 7.468328 8.256061 |
+---------------------------------------+
. qui xtgls y x1-x7, panels(correlated) corr(ar1)
. est store xtdata_gls
. restore
. est table *gls, b(%6.3f) se(%6.4f)
----------------------------------
Variable | gls xtdat~s
-------------+--------------------
x1 | 2.542 3.408
| 0.8199 0.0361
x2 | -0.046 -0.083
| 0.0296 0.0002
x3 | 0.174 0.173
| 0.0158 0.0002
x4 | 0.147 0.145
| 0.0416 0.0002
x5 | 0.266 0.245
| 0.0675 0.0007
x6 | 0.766 1.392
| 0.5391 0.0089
x7 | -0.235 -0.178
| 0.1038 0.0006
dump2 | 0.000
| 0.0000
dump3 | 0.000
| 0.0000
dump4 | -2.703
| 0.9691
dump5 | -3.749
| 1.2713
dump6 | -6.226
| 1.0935
dump7 | 0.000
| 0.0000
dump8 | -3.690
| 1.0020
dump9 | -5.869
| 1.0228
dump10 | -7.953
| 1.2604
dump11 | -8.050
| 1.2656
_cons | -19.136 -30.995
| 6.1864 0.3388
----------------------------------
legend: b/se
. * Comment: the fact that T<N make the differnece between these two methods
.
.
. *===============Part II========Arlion's results=========
. * now, we drop three provinces, so that T>=N
. preserve
. drop if province <4
(27 observations deleted)
. drop dump2-dump4
.
. * method_1-revisit
. qui xtgls y x1-x7 dump*, panels(correlated) corr(ar1)
. est store gls_a
. * method_2-revisit
. xtdata, fe clear
. list p year y x1 in 1/10
+---------------------------------------+
| province year y x1 |
|---------------------------------------|
1. | 4 1997 10.04606 8.137411 |
2. | 4 1998 7.846379 8.264727 |
3. | 4 1999 6.175583 8.327683 |
4. | 4 2000 8.844497 8.383391 |
5. | 4 2001 7.008513 8.471063 |
|---------------------------------------|
6. | 4 2002 8.620567 8.552408 |
7. | 4 2003 9.793627 8.64372 |
8. | 4 2004 11.18905 8.761012 |
9. | 4 2005 10.48378 8.936693 |
10. | 5 1997 7.785256 8.184393 |
+---------------------------------------+
. qui xtgls y x1-x7, panels(correlated) corr(ar1)
. est store xtdata_gls_a
. est table *gls_a, b(%6.3f) se(%6.4f)
----------------------------------
Variable | gls_a xtdat~a
-------------+--------------------
x1 | 2.411 2.411
| 0.6115 0.6115
x2 | -0.040 -0.040
| 0.0173 0.0173
x3 | 0.108 0.108
| 0.0105 0.0105
x4 | 0.183 0.183
| 0.0284 0.0284
x5 | 0.230 0.230
| 0.0471 0.0471
x6 | -0.000 -0.000
| 0.3401 0.3401
x7 | -0.197 -0.197
| 0.0803 0.0803
dump5 | -0.659
| 0.7207
dump6 | -3.398
| 0.3251
dump7 | -0.531
| 0.4686
dump8 | -0.771
| 0.9007
dump9 | -2.071
| 0.7331
dump10 | -4.077
| 0.7243
dump11 | -5.178
| 0.8516
_cons | -17.213 -19.298
| 4.2625 3.9856
----------------------------------
legend: b/se
. restore
. * Comment: now, the same results got from these two methods.
.
.
. *===============Part III========The correct way to estimate shaoshuai521's model=========
. qui xtscc y x1-x7,fe
. est store xtscc
. qui xtreg y x1-x7,fe
. est store fe
. qui xtreg y x1-x7,fe robust
. est store fe_r
. qui xtgls y x1-x7, p(h) corr(ar1)
. est store gls_h_ar
. est table xtscc fe fe_r gls_h_ar, b(%6.3f) se(%6.4f)
------------------------------------------------------
Variable | xtscc fe fe_r gls_h~r
-------------+----------------------------------------
x1 | 3.681 3.681 3.681 1.849
| 0.7265 1.8696 1.5566 0.8573
x2 | -0.087 -0.087 -0.087 -0.053
| 0.0223 0.0547 0.0461 0.0222
x3 | 0.172 0.172 0.172 0.077
| 0.0249 0.0369 0.0398 0.0269
x4 | 0.138 0.138 0.138 0.134
| 0.0709 0.0799 0.0730 0.0622
x5 | 0.237 0.237 0.237 0.221
| 0.0687 0.1688 0.2120 0.1087
x6 | 1.513 1.513 1.513 -1.179
| 0.3490 1.0874 1.0292 0.7675
x7 | -0.200 -0.200 -0.200 0.064
| 0.1168 0.1952 0.2166 0.1379
_cons | -33.034 -33.034 -33.034 -11.886
| 4.4667 13.7273 11.0145 7.2353
------------------------------------------------------
legend: b/se
. * Comment:
. * (1) the results got from xtgls is seriouly different from those got form xtreg or xtscc
. * (2) xtreg,fe robust consider only het
. * (3) xtscc,fe consider both het, ar, and cross-scetional correlation.
.
. * Moreover, I sugguset you to drop x1, because x1 is seriouly correlated to other regressors
. pwcorr y x*, star(0.01)
| y x1 x2 x3 x4 x5 x6
-------------+---------------------------------------------------------------
y | 1.0000
x1 | 0.5370* 1.0000
x2 | 0.0250 0.3916* 1.0000
x3 | 0.3652* 0.5073* 0.4936* 1.0000
x4 | 0.1633 0.6048* 0.4015* 0.1519 1.0000
x5 | -0.3231* -0.4265* -0.1435 -0.5044* -0.0787 1.0000
x6 | -0.4580* -0.5588* -0.3567* -0.5632* -0.1109 0.4269* 1.0000
x7 | 0.0363 -0.2149 -0.5626* 0.0404 -0.3338* 0.1966 0.0181
| x7
-------------+---------
x7 | 1.0000
. * we can see that, x1 is correlated with x2-x6 at 1% significant level.
.
. log close
log: D:\stata9\ado\personal\others\shao.log
log type: text
closed on: 26 Sep 2007, 09:58:32
----------------------------------------------------------------------------------------------------------
[此贴子已经被作者于2007-9-26 10:21:04编辑过]
非常感谢arlionn的详细解答!
arlionn说:
(3) xtscc,fe consider both het, ar, and cross-scetional correlation.
stscc的help里面说的是:
fe performs fixed-effects (within) regression with Driscoll and Kraay
standard errors. These standard errors are robust to general forms
of cross-sectional ("spatial") and temporal dependence (provided that
T is sufficiently large). See above. If the residuals are assumed to
be heteroskedastic only, use xtreg, fe robust.
这个说法与arlionn的说法基本一致,那么lag选项的功能是什么?
HELP里的说明如下:
lag(#) specifies the maximum lag to be considered in the autocorrelation
structure. By default, a lag length of m(T)=floor[4(T/100)^(2/9)] is
assumed.
我不太理解,是指存在几阶自相关么?
如果是的话,那么选择fe和同时选择fe lag(1)的估计结果应该是一致,但是结果却不是这样的!
请问arlionn选项lag到底是什么作用?
是不是只选择fe选项就能得到三种误差就都被消除的稳健结果了?
扫码加好友,拉您进群



收藏
