楼主: lizhewenbei
4495 8

[回归分析求助] 请教大家,如何让回归结果中的Industry和Year变量都藏起来? [推广有奖]

  • 15关注
  • 5粉丝

副教授

36%

还不是VIP/贵宾

-

威望
0
论坛币
309 个
通用积分
11.4770
学术水平
4 点
热心指数
13 点
信用等级
5 点
经验
9699 点
帖子
609
精华
0
在线时间
496 小时
注册时间
2008-2-6
最后登录
2024-1-9

相似文件 换一批

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
请教大家,如何让回归结果中的Industry和Year变量都藏起来?即利用esttab时直接删除黄色部分和红色部分?

我的程序:
  1. global controls sq_size sq_lev sq_roa  sq_cash ///
  2. sq_p_indirpc sq_age_ceo sq_male_ceo  ///
  3. sq_listage sq_soe sq_boardsize sq_top1 yr1-yr16 in1-in21

  4. sum independ $controls


  5. /*etr   lretr   btd   dd_btd   btdfactor   shelter
  6. jone_risk1   jone_risk2   li_risk2   hua_risk1a   hua_risk1b   hua_risk5   hua_risk4
  7. totalrisk_a   totalrisk_b   systematic   unsystematic
  8. abs_resid_inv   resid_inv*/


  9. //Panel A: Full sample
  10. reg etr           independ    $controls  , cluster(stkcd)  //
  11.   est store m1
  12. reg lretr           independ    $controls  , cluster(stkcd)  //
  13.   est store m2
  14. reg btd           independ    $controls  , cluster(stkcd)  //
  15.   est store m3
  16. reg btdfactor           independ    $controls  , cluster(stkcd)  //
  17.   est store m4
  18. reg shelter           independ    $controls  , cluster(stkcd)  //
  19.   est store m5
  20.   
  21. esttab m1 m2 m3 m4 m5 using freq.csv, replace ///
  22.   b(%6.2f) parenthese t ///
  23.   star (* 0.1 ** 0.05 *** 0.01) ///
  24.   scalar(N F r2 r2_a r2_p) obslast compress nogap
复制代码


输出的结果
1.png
二维码

扫码加我 拉你入群

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

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

关键词:Industry year 回归结果 USTR Dust controls store

沙发
蓝色 发表于 2017-5-13 21:32:13 |只看作者 |坛友微信交流群
建议用outreg2命令
里面有选项是关于保留显示的变量的
下面是outreg2帮助里面的例子

Example 8. Drop/keep/order variables


    Specifying a varlist can be convenient to limit the output table to only the essential coefficients.  For example, we may want to control for the influence of dummy variables, but not report their estimated coefficients.

    sysuse auto, clear
    tab rep78, gen(repair)
    regress mpg foreign weight repair1-repair4
    outreg2 weight foreign using myfile, drop(repair*)

    Alternatively, keep( ) and drop( ) can be used to control the displayed variables. Use nocons to drop constants.

    outreg2 using myfile, drop(repair*) replace
    outreg2 using myfile, keep(mpg foreign)
    outreg2 using myfile, nocons
    seeout

    There are several ways to order variables in the output. The first is to order them when running regression. The second way is to specify varlist from within outreg2. Or you might try sortvar( ) or groupvar( ).

    * single equation
    reg mpg rep78 head trunk weight
    outreg2 using myfile, replace sortvar(trunk turn)
    reg mpg rep78 head weight turn disp gear
    outreg2 using myfile, sortvar(trunk turn) see

    * multiple equations
    reg3 (mpg rep78 head trunk weight) (head trunk weight rep78 gear)
    outreg2 using myfile, replace long
    reg3 (mpg rep78 head weight turn disp ) (mpg rep78 head trunk weight gear)
    outreg2 using myfile, sortvar(trunk turn) see long

    * groupvar( ) will create super-rows
    reg mpg rep78 head trunk weight
    outreg2 using myfile, replace
    reg mpg rep78 head weight turn disp gear
    outreg2 using myfile, groupvar(Group1 trunk turn head weight Group2) see

已有 1 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
lizhewenbei + 3 + 3 + 3 + 3 精彩帖子

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

使用道具

藤椅
lizhewenbei 学生认证  发表于 2017-5-13 21:59:20 |只看作者 |坛友微信交流群
蓝色 发表于 2017-5-13 21:32
建议用outreg2命令
里面有选项是关于保留显示的变量的
下面是outreg2帮助里面的例子
非常感谢您!我一直采用的都是outreg2,之所以现在换成esttab,是因为outreg2有两个问题:

1、OLS一直挺正常,但是Logit的回归结果使用outreg2总是异常,程序例如为:
  1. logit depend1     independ  $controls, cluster(stkcd)  //
  2. outreg2 using result2, excel addstat(pseudo r-square, `e(r2_p)') bdec(3) tstat td(2) replace

  3. logit depend2     independ  $controls, cluster(stkcd)  //
  4. outreg2 using result2, excel addstat(pseudo r-square, `e(r2_p)') bdec(3) tstat td(2) append
复制代码
但是第二个回归的结果无法通过append紧接着第一个回归展示

2、如果一组回归中,有几个是OLS,有几个是Logit,那么更难以用outreg2一字排开。我的理解是
OLS的outreg2为
  1. reg continous1  independ   $controls, cluster(stkcd)  //
  2. outreg2 using result2, excel bdec(3) rdec(2) tstat td(2) replace
  3. reg continous2  independ   $controls, cluster(stkcd)  //
  4. outreg2 using result2, excel bdec(3) rdec(2) tstat td(2) append
复制代码
但是
Logit的outreg2是
  1. logit dummy1     independ  $controls, cluster(stkcd)  //
  2. outreg2 using result2, excel addstat(pseudo r-square, `e(r2_p)') bdec(3) tstat td(2) replace
  3. logit dummy2     independ  $controls, cluster(stkcd)  //
  4. outreg2 using result2, excel addstat(pseudo r-square, `e(r2_p)') bdec(3) tstat td(2) append
复制代码
由于outreg2的写法不同,很难处理“既包含OLS,又包含LOGIT”的一组(比如10个)回归模型

使用道具

板凳
蓝色 发表于 2017-5-13 22:21:35 |只看作者 |坛友微信交流群
没有问题啊
logit也可以的
你重新下载一个outreg2

使用道具

报纸
蓝色 发表于 2017-5-13 22:26:02 |只看作者 |坛友微信交流群
没有问题啊
这就是随便一个数据生成的结果
result2.xml.zip (1.68 KB) 本附件包括:
  • result2.xml

使用道具

地板
lizhewenbei 学生认证  发表于 2017-5-13 22:59:31 |只看作者 |坛友微信交流群
蓝色 发表于 2017-5-13 22:26
没有问题啊
这就是随便一个数据生成的结果


可能真是我的STATA版本问题,我原封不动地粘贴您刚刚发给我的代码,但是STATA不能识别drop
提示语为“invalid 'drop' ”

使用道具

7
治疗乐晰 学生认证  发表于 2018-5-7 09:20:13 |只看作者 |坛友微信交流群
楼主有个问题 就是outreg2输出多个回归结果的时候 无论是它修正的r2或者伪r2只能是最后一个回归方程的 你知道该怎么操作吗

使用道具

8
henry0227 发表于 2021-8-23 22:49:12 |只看作者 |坛友微信交流群
请问楼主解决问题了吗?我用esttab也出现了问题,我也不知道如何把Industry和Year变量藏起来

使用道具

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

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-5-7 05:56