楼主: chenyu890707
52319 41

[编程问题求助] stata如何把工具变量回归的第一,第二阶段同时输出excel或word格式呢? [推广有奖]

11
lsssl524 发表于 2017-1-23 11:54:11

楼上答主的回答稍有遗漏,貌似使用ivregress是无法直接导出第一阶段回归的,但是使用ivregess可以。
根据help helpreg2的文档得到:
Q: How do I report the first-stage from ivregress?
    A: This has been the most frequently asked question with outreg2. What had been requested was a full
       compatibility with the rest of Stata, i.e., factor variables, post estimation commands, etc. This was
       impletemented for the first time by ivregress2, which was the first to extend the official version in
       about 5 or 6 years.

再次help ivregress2得到各类例子,例如:
ivregress2 2sls mpg weight (length=displacement), first
    est restore first
    outreg2 using myfile, cttop(first) replace
    est restore second
    estat firststage
    local fstat `r(mineig)'
    estat endogenous
    local p_durbin `r(p_durbin)'
    outreg2 using myfile, cttop(second) excel adds(IV F-stat, `fstat', Durbin pval, `p_durbin')

这次就可以得到第一阶段回归结果了。
已有 6 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
ruanhaoya + 1 + 1 + 1 精彩帖子
niaofei57 + 1 + 1 精彩帖子
重庆刘飞 + 1 + 1 + 1 精彩帖子
黃河泉 + 5 + 5 + 5 好的意见建议
lzy1201020112 + 2 好的意见建议
admin_kefu + 20 热心帮助其他会员

总评分: 论坛币 + 20  学术水平 + 8  热心指数 + 10  信用等级 + 7   查看全部评分

12
zpp814 发表于 2017-4-11 20:35:58
你好。输入 est restore first后,stata界面总是显示 estimation result first not found,这是为什么?求指教,谢谢!

13
aliceyzq 发表于 2017-4-11 20:53:30
zpp814 发表于 2017-4-11 20:35
你好。输入 est restore first后,stata界面总是显示 estimation result first not found,这是为什么?求指 ...
用ivregrees2命令就不会有上面的提示了

14
peyzf 发表于 2017-7-21 14:49:11
蓝色 发表于 2017-1-3 20:19
都一年了啊

上网搜索解决办法啊,
输入代码est restore first后,系统报错

est restore first
estimation result first not found

这时应该如何处理呀?

15
黃河泉 在职认证  发表于 2017-7-21 15:25:42
peyzf 发表于 2017-7-21 14:49
输入代码est restore first后,系统报错

est restore first
你的楼上已经回答了!但是你需要外挂 ssc install ivregress2 并见例子!

16
黃河泉 在职认证  发表于 2017-7-21 15:28:16
很遗憾地,ivreg2 与 outreg2 似乎还是无法合在一起使用!

17
peyzf 发表于 2017-7-21 15:51:52
黃河泉 发表于 2017-7-21 15:28
很遗憾地,ivreg2 与 outreg2 似乎还是无法合在一起使用!
谢谢,我使用的是xtivreg,能否兼容?

18
黃河泉 在职认证  发表于 2017-7-21 16:20:42
peyzf 发表于 2017-7-21 15:51
谢谢,我使用的是xtivreg,能否兼容?
恐怕是不相容!恐怕需要自己先跑第一阶段,用 outreg2 存起来;然后再跑一般的 xtivreg(2),再用 outreg2 存起来 !

19
peyzf 发表于 2017-7-21 16:55:59
感谢楼上的朋友。只能手动合并啦

20
zlsir 发表于 2017-8-31 10:27:06
peyzf 发表于 2017-7-21 16:55
感谢楼上的朋友。只能手动合并啦
请问手动是如何合并的呢?我想把工具变量分为两步来做,但是不知道怎么把第一步的结果和第二步联系起来

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-8 07:49