楼主: hqs811
3299 2

[编程问题求助] stata 面板数据by group xtreg,fe 输出问题 [推广有奖]

  • 3关注
  • 0粉丝

已卖:172份资源

硕士生

60%

还不是VIP/贵宾

-

威望
0
论坛币
2312 个
通用积分
28.8975
学术水平
1 点
热心指数
1 点
信用等级
1 点
经验
1051 点
帖子
76
精华
0
在线时间
212 小时
注册时间
2011-10-11
最后登录
2024-11-6

楼主
hqs811 发表于 2016-8-12 11:59:38 |AI写论文
100论坛币
大家好,今日发帖求教,首先感谢各位宝贵时间,问题如下:

数据如下:

id              y        x1      x2       fyear    class
10001      3         4       5         1999      15
10002      1        2       9         1999      15
10003      5         8       2         1999      16
10004      2         2       1          1999     16
10001      9         1       5         2000      15
10002      1        2       9         2000      15
10003      5        1       7         2000      16
10007      3        ..       ..          2000      16

10001      7         4       5         2001      15
10002       4       2       9         2001     15
10003       2       8       2          2001      16
10009       3        7      2          2001       16

特征:
1.  一个id和fyear的combination决定了 unique observation
2.  一个class可以包含多个id,每年可以有进出

有一段code是这样的
/*设置panel data*/
xtset id
/* fixed effect and between */
xtreg y x1 i.fyear, fe
est store reg1
xtreg y x1  i.fyear, be
est store reg2
xtreg y x1 x2 i.fyear, fe
est store reg3
xtreg y x1 x2 i.fyear, be
est store reg4
xtset, clear
outreg2 [reg1 reg2 reg3 reg4] using tabletimefebe.xls, word drop(_I* o.*) replace


这一段code大体做了这样一些事情
1. 按照gvkey(individual firm identifier) 设置panel
2. regress y on x1 和时间的dummies (i.fyear), 用xtreg里面的fixed effect和between effect
3. regress y on x1 x2 和时间的dummies(i.fyear), 用fixed effect 和between effect

现在的问题是: 如何能按照class来把这些regression对每个class的subgroup再做一遍,也就是说
by class: do 上面的命令
我知道可以每个xtreg前面都加by class:
但问题是,如何能把每个regression的不同的class的结果放在一个excel文件里输出,方便比较
向大家求教如何把outreg 和 by var, xtreg, fe或者be, 三者结合在一起。并且能让结果自动输出,谢谢!


谢谢各位了!

关键词:Group xtreg Stata 面板数据 tata

沙发
hqs811 发表于 2016-8-12 22:04:22
up 求助!

藤椅
rqbh165 发表于 2021-7-21 14:54:21
同问!

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-29 06:48