全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
14767 15
2009-09-18
各位老师:
我在数据计算过程中需要直接引用标准回归系数即引用reg y x1 x2 x3 x4,beta.的标准回归系数,用_b()引用的是回归系数,而不是标准系数,请老师帮忙!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2009-9-18 21:26:10
将所有变量标准化
用egen y1=std(y),mean(0) std(1)
    egen x11=std(x1),mean(0) std(1) ......
reg y1 x11 x21 x31 x41 即可得到标准回归系数
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2009-9-19 09:54:09
jzhyue 发表于 2009-9-18 19:39 我在数据计算过程中需要直接引用标准回归系数即引用reg y x1 x2 x3 x4,beta.的标准回归系数
reg y x1-x4,b

reg y x1-x4

得出相同结果?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2009-9-19 10:28:29
sungmoo 发表于 2009-9-19 09:54
jzhyue 发表于 2009-9-18 19:39 我在数据计算过程中需要直接引用标准回归系数即引用reg y x1 x2 x3 x4,beta.的标准回归系数
reg y x1-x4,b

reg y x1-x4

得出相同结果?
动手实践一下
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2009-9-19 14:54:15
dxystata 发表于 2009-9-19 10:28 动手实践一下
前面问的就是实践的结果。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2009-9-19 21:19:06
5# sungmoo
总结两位老师的解答,问题得以解决,举例如下(附do文件及结果):
reg y x1-x6 与 reg y x1-x6,beta  结果回归系数一样,但前者没有显示标准回归系数,并且后者的标准系数也没有办法贮存在变量或matrix中,这是我比较关心的
但通过将数据标准化后,reg y x1-x6与reg y x1-x6,beta结果便一样,并且reg y x1-x6,beta中回归系数和标准回归系数是相同的,并且mat a=e(b) 可以引用标准回归系数(实质上我引用的是与标准回归系数相同的回归系数)
不知对否,请各位老师指正!
另外我还有一个不会用,比如我想把结果中的每个标准系数存在scalar a1 a2...,不知怎么实现,请老师们指导!
capture sysuse auto,clear
drop mpg
drop rep78
drop headroom
drop trunk
drop turn
drop foreign
egen sprice=std(price),mean(0) std(1)
egen sw=std(weight),mean(0) std(1)
egen sl=std(length),mean(0) std(1)
egen sd=std(disp),mean(0) std(1)
egen sg=std(gear),mean(0) std(1)
reg  price weight length displacement gear_ratio
reg  price weight length displacement gear_ratio,beta
reg  sprice sw sl sd sg,beta
ereturn list
mat a=e(b)
matlist a

结果如下,
. reg  price weight length displacement gear_ratio
Source        SS       df       MS              Number of obs =      74
F(  4,    69) =   11.04
Model    247810070     4  61952517.6           Prob > F =  0.0000
Residual    387255326    69  5612396.02           R-squared =  0.3902
Adj R-squared =  0.3549
Total    635065396    73  8699525.97           Root MSE =    2369

price       Coef.   Std. Err.      t    P>t     [95% Conf. Interval]

weight    4.915578   1.367776     3.59   0.001      2.18694 7.644216
length   -103.8873   38.64346    -2.69   0.009    -180.9788 -26.79567
displacement    9.570863   7.893187     1.21   0.229    -6.175615 25.31734
gear_ratio    2395.815   1091.898     2.19   0.032      217.537 4574.092
_cons     1735.29   5817.673     0.30   0.766    -9870.649 13341.23

. reg  price weight length displacement gear_ratio,beta
Source        SS       df       MS              Number of obs =      74
F(  4,    69) =   11.04
Model    247810070     4  61952517.6           Prob > F =  0.0000
Residual    387255326    69  5612396.02           R-squared =  0.3902
Adj R-squared =  0.3549
Total    635065396    73  8699525.97           Root MSE =    2369

price       Coef.   Std. Err.      t    P>t Beta

weight    4.915578   1.367776     3.59   0.001 1.295257
length   -103.8873   38.64346    -2.69   0.009 -.7842659
displacement    9.570863   7.893187     1.21   0.229 .2980039
gear_ratio    2395.815   1091.898     2.19   0.032 .3706326
_cons     1735.29   5817.673     0.30   0.766 .

. reg  sprice sw sl sd sg,beta
Source        SS       df       MS              Number of obs =      74
F(  4,    69) =   11.04
Model   28.4854684     4   7.1213671           Prob > F =  0.0000
Residual    44.514532    69  .645138145           R-squared =  0.3902
Adj R-squared =  0.3549
Total   73.0000004    73  1.00000001           Root MSE =   .8032

sprice       Coef.   Std. Err.      t    P>t Beta

sw    1.295257   .3604096     3.59   0.001 1.295257
sl   -.7842659   .2917273    -2.69   0.009 -.7842659
sd    .2980039   .2457669     1.21   0.229 .2980039
sg    .3706326   .1689167     2.19   0.032 .3706326
_cons    3.13e-09   .0933707     0.00   1.000 .

. ereturn list
scalars:
e(N) = 74
e(df_m) = 4
e(df_r) = 69
e(F) = 11.03851501263808
e(r2) = .3902118936857077
e(rmse) = .8032049208933202
e(mss) = 28.48546839290257
e(rss) = 44.51453200135989
e(r2_a) = .3548618585370531
e(ll) = -86.19622382315104
e(ll_0) = -104.4980425309136
e(rank) = 5
macros:
e(cmdline) : "regress sprice sw sl sd sg,beta"
e(title) : "Linear regression"
e(marginsok) : "XB default"
e(vce) : "ols"
e(depvar) : "sprice"
e(cmd) : "regress"
e(properties) : "b V"
e(predict) : "regres_p"
e(model) : "ols"
e(estat_cmd) : "regress_estat"
matrices:
e(b) : 1 x 5
e(V) : 5 x 5
functions:
e(sample)   
. mat a=e(b)
. matlist a
sw sl         sd sg _cons
   
y1   1.295257 -.7842659   .2980039 .3706326 3.13e-09
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群