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

博文

STATA数据运行后——输出大全

已有 21933 次阅读 2015-3-16 15:24 |个人分类:STATA|系统分类:教学心得




2.STATA回归输出格式总结,非常的全面和使用。


STATA回归输出格式的设定命令

http://repec.org/bocode/e/estout/

estimates table small large, b(%7.4f) se(%7.4f) stats(N r2_a)
-----------------------------------
sysuse auto,clear
tabstat price wei len mpg rep78, stats(mean sd min p50 max) c(s) f(%6.2f)

logout, save(mytable) word replace: tabstat price wei len mpg rep78, stats(mean sd min p50 max) c(s) f(%6.2f)


logout,save(mytable) word replace: pwcorr_a price wei len mpg rep78

logout,save(mytable) word replace: pwcorrs price wei len mpg rep78,sp
//pwcorrs 可以输出Spearman 相关系数表。

mat a=I(10)
mat list a
logout , save(mytable) word replace:mat list a,nohalf

-----------------------------------
sysuse auto,clear
reg price wei
  est store m1
reg price wei len
  est store m2
reg price wei len mpg foreign
  est store m3

esttab m1 m2 m3

esttab m1 m2 m3,ar2 compress nogap  star(* 0.1 ** 0.05 *** 0.01)

esttab m1 m2 m3,ar2 compress nogap star(* 0.1 ** 0.05 *** 0.01)  b(%6.3f) brackets p

esttab m1 m2 m3,beta

label var weight "汽车重量"
esttab m1 m2 m3,label

esttab m1 m2 m3,margin //默认省略Constant
esttab m1 m2 m3,margin constant

esttab m1 m2 m3 using myout.html,replace  //追加的话,replace换为

append
esttab m1 m2 m3 using myout.csv,replace
esttab m1 m2 m3 using myout.csv,replace compress nogap nonotes scalars(r2_a N F)  star(* 0.1 ** 0.05 *** 0.01 ) obslast title("输入标题") addnotes("*** 1%  ** 5%  * 10%" "" "")

-----------------------例子-----------------------------
sysuse auto,clear
reg price wei
  est store m1
reg price wei len
  est store m2
reg price wei len mpg foreign
  est store m3

logout , save(mylogout) word replace fix(3): esttab m1 m2 m3,mtitle(模型1 模型2 模型3) b(%6.3f) se(%6.2f) se star(* 0.1 ** 0.05 *** 0.01 ) scalar(r2 r2_a N F) compress nogap

以上比较牛逼!

--------------------------------------------------------

sysuse auto,clear
reg price wei
  est store m1
reg price wei len
  est store m2
reg price wei len mpg foreign
  est store m3

xml_tab m1 m2 m3 , replace
//默认显示标签,保存名称为stata_out.xml

xml_tab m1 m2 m3 , save(result) sheet(OLS) replace ///
                                tstat blew stats(r2 r2_a N)
xml_tab m1 m2 m3 , save(result) sheet(OLS) replace ///
                                tstat blew stats(r2 r2_a N)        ///
           drop(_Ioccup) font("Times new Roman" 10)  ///
           title(table 1 表名)                                          ///
           tblank(1)   format(NCCR3)                            ///
           note("注释")
//中文标签要先修改或 nolabel
//save()  可以有具体路径
//可以有多个sheet

--------------------outreg2--------------------------
sysuse nlsw88,clear
tab race,gen(d_race)
 drop d_race1
tab occu,gen(d_occu)
 drop d_occu1
reg wage hours ttl_exp married
 est store m1
reg wage hours ttl_exp married d_race*
 est store m2
reg wage hours ttl_exp married d_race* d_occu*
 est store m3
outreg2 [m1 m2 m3] using tab01,seeout replace

outreg2 [m1 m2 m3] using tab01,word replace
outreg2 [m1 m2 m3] using tab01,excel replace

outreg2 [m1 m2 m3] using tab01,word replace label

outreg2 [m1 m2 m3] using tab01,word replace tstat
               //t统计量
outreg2 [m1 m2 m3] using tab01,word replace pvalue
               //p值
outreg2 [m1 m2 m3] using tab01,word replace tstat tdec(2)///
rdec(3)
//t统计量小数点后两位 R2小数点后三位




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

上一篇:金融计量教学资料
下一篇:差分广义矩( DiffGMM) 和系统广义矩(SYSGMM)
收藏 IP: 111.203.16.*| 热度|

0

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

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

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

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

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部