连帮主玉君哥在《财经研究》2007,《统计研究》2008,《金融研究》2010,发表的论文中提到一种用bootstrap方法比较组间差异,如何在stata中实现啊?结合一个具体的问题来说明,请高手赐教!
1000(n)个观测样本公司,600(n1)个样本公司是民营的,400(n2)个样本公司是国有的,被解释变量是公司绩效(y),解释变量是第一大股东持股比例(x),z表示控制变量(假定只有一个),根据所有权性质不同进行分组回归,且假定模型设定是正确的,无自相关,异方差等问题,具体如下:
600个民营样本公司回归:y=a0+a1*x+a2*z+u
400个国有样本公司回归:y= b0+b1*x+b2*z+u
采用ols回归结果显示a1 大于 b1,如何在stata中用bootstrap方法证明a1 大于 b1在统计上是显著的?请高手赐教,跪谢!求教很多人,都解决不了,只能寄希望人大论坛了!
大小:2.63 KB
本附件包括:
. *-Testing bdiff.ado
.
. *-https://bbs.pinggu.org/thread-1201007-3-1.html
.
.
. *==========================
. *-测试程序 1:基于 20# 楼的数据
. *==========================
.
. cd D:\stata11\ado\personal\temp
D:\stata11\ado\personal\temp
. use panel_bdiff, clear
. global xx "rd lnasset" // 解释变量
. xtset id year
panel variable: id (strongly balanced)
time variable: year, 2005 to 2010
delta: 1 unit
. xtreg roe $xx if indus==1,fe
Fixed-effects (within) regression Number of obs = 54
Group variable: id Number of groups = 9
R-sq: within = 0.0483 Obs per group: min = 6
between = 0.0227 avg = 6.0
overall = 0.0000 max = 6
F(2,43) = 1.09
corr(u_i, Xb) = -0.3827 Prob > F = 0.3453
------------------------------------------------------------------------------------------------
roe | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+---------------------------------------------------------------------------------
rd | -1.609766 1.6261 -0.99 0.328 -4.889109 1.669577
lnasset | .0769762 .054283 1.42 0.163 -.0324959 .1864482
_cons | -1.373778 1.108069 -1.24 0.222 -3.608413 .8608566
-------------+---------------------------------------------------------------------------------
sigma_u | .16055938
sigma_e | .15058293
rho | .53203101 (fraction of variance due to u_i)
------------------------------------------------------------------------------------------------
F test that all u_i=0: F(8, 43) = 5.48 Prob > F = 0.0001
. mat b1 = e(b)
. est store m1
. xtreg roe $xx if indus==0,fe
Fixed-effects (within) regression Number of obs = 54
Group variable: id Number of groups = 9
R-sq: within = 0.1711 Obs per group: min = 6
between = 0.1586 avg = 6.0
overall = 0.0000 max = 6
F(2,43) = 4.44
corr(u_i, Xb) = -0.5042 Prob > F = 0.0177
----------------------------------------------------------------------------------------------------
roe | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+-------------------------------------------------------------------------------------
rd | -2.61159 1.06554 -2.45 0.018 -4.760455 -.462724
lnasset | -.0037579 .0207355 -0.18 0.857 -.0455751 .0380592
_cons | .2340589 .4225673 0.55 0.583 -.6181293 1.086247
-------------+--------------------------------------------------------------------------------------
sigma_u | .07414931
sigma_e | .05933944
rho | .60959567 (fraction of variance due to u_i)
----------------------------------------------------------------------------------------------------
F test that all u_i=0: F(8, 43) = 5.22 Prob > F = 0.0001
. mat b2 = e(b)
. est store m2
. *-结果对比
. esttab m1 m2, mtitle(m1 m2) nogap
--------------------------------------------
(1) (2)
m1 m2
--------------------------------------------
rd -1.610 -2.612*
(-0.99) (-2.45)
lnasset 0.0770 -0.00376
(1.42) (-0.18)
_cons -1.374 0.234
(-1.24) (0.55)
--------------------------------------------
N 54 54
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
.
. *-记录真实差异
. mat D = (b1 \ b2 \ b1-b2)
. local d1_0 = D[3,1] // 第一个解释变量的系数差异
. local d2_0 = D[3,2] // . 二....
. mat list D // 真实差异
D[3,3]
rd lnasset _cons
y1 -1.6097659 .07697617 -1.3737783
y1 -2.6115897 -.00375792 .2340589
y1 1.0018238 .08073409 -1.6078372
.
. *-Bootstrap 系数差异
. bdiff roe $xx, truediff(`d1_0' `d2_0') n1(9) bs(100) seed(123)
Begin Time :14 Oct 2011 09:01:49
Bootstrap 组间系数差异检验
--------------------------------------------------------------
变量 真实差异 抽样差异 实证 P 值
--------------------------------------------------------------
rd 1.0018 0.1777 0.3100
lnasset 0.0807 -0.0015 0.0000
--------------------------------------------------------------
自抽样次数: 100
Author: Lian Yu-jun http://toran.cn/arlion
Over Time :14 Oct 2011 09:01:52
Total seconds the procedures spent are 3