楼主: 宜风
5847 8

[编程问题求助] 一次性输出几个回归的lincom [推广有奖]

  • 0关注
  • 0粉丝

已卖:14份资源

讲师

45%

还不是VIP/贵宾

-

威望
0
论坛币
2781 个
通用积分
240.3385
学术水平
4 点
热心指数
6 点
信用等级
2 点
经验
29305 点
帖子
111
精华
0
在线时间
739 小时
注册时间
2013-8-24
最后登录
2024-3-7

楼主
宜风 发表于 2018-1-31 16:50:20 |AI写论文
20论坛币
我做了若干回归,有如下命令:

qui reg y x1 x2 x3
est store m1
qui reg y x1 x2 x4
est store m2
qui reg y x1 x2 x5
est store m3
esttab m1 m2 m3

但是我想知道每一个回归的lincom x1+x2,并希望结果显示在输出表格中,可以实现吗?怎么实现?谢谢~

最佳答案

蓝色 查看完整内容

看outreg2帮助里面的的 example9
关键词:lincom Inc COM Lin NCO

回帖推荐

蓝色 发表于2楼  查看完整内容

看outreg2帮助里面的的 example9

沙发
蓝色 发表于 2018-1-31 16:50:21
看outreg2帮助里面的的
example9

藤椅
宜风 发表于 2018-2-1 14:13:16
蓝色 发表于 2018-1-31 18:04
看outreg2帮助里面的的
example9
谢谢回答,但是仍有疑问,比如
qui reg y x1 x2 x3
est store m1
lincom x1+x2
local joint1=r(estimate)

qui reg y x1 x2 x4
est store m2
lincom x1+x2
local joint2=r(estimate)

outreg2 [m1 m2] using "myfile", adds (joint, `joint1' `joint2') replace see

想要的结果是m1一列的joint显示joint1暂元内的数字,m2那一列的joint行显示joint2暂元内的数字,请问上面的那个outreg2应该怎么更改?谢谢~

板凳
宜风 发表于 2018-2-1 14:57:48
蓝色 发表于 2018-1-31 18:04
看outreg2帮助里面的的
example9
我知道如何解决了,谢谢~

qui reg y x1 x2 x3
est store m1
lincom x1+x2
local joint1=r(estimate)
outreg2 using "myfile", adds (joint, `joint1') replace see

qui reg y x1 x2 x4
est store m2
lincom x1+x2
local joint2=r(estimate)
outreg2 using "myfile", adds (joint, `joint2') see

分别outreg,第二次只要把replace去掉就会自动在m1后面添加新的一列m2

报纸
宜风 发表于 2018-2-1 14:59:21
蓝色 发表于 2018-1-31 18:04
看outreg2帮助里面的的
example9
但是还想问一下,我想让·joint1‘保留三位小数,根据P值自动带星号,能做到吗?谢谢~

地板
蓝色 发表于 2018-2-1 16:15:06
加参数  dec(3)  就是小数点
但星号不能控制

7
宜风 发表于 2018-2-1 16:29:02
蓝色 发表于 2018-2-1 16:15
加参数  dec(3)  就是小数点
但星号不能控制
我已经加了dec(3),回归中的结果都保留三位了,但是对lincom的joint, t-stat和p-value结果不起作用......

8
蓝色 发表于 2018-2-1 16:36:56
遇到问题先,看帮助里面的介绍
用adec

      +----------------------+

    ----+ Decimals and Formats +--------------------------------------------------------

    auto(integer) the number of automatically formatted decimals, the default is
        auto(3), i.e. three significant digits not counting the ones (i.e. the digit to
        the left of the decimal point).  This means 1.234 and 0.123 might be displayed,
        while 12.345 or 0.1234 will be trimmed. A probable integer is reported without
        decimals. A very large or small number will be displayed in exponential format.
        Specify dec( ) or bdec( ) to disable it.

    less(integer) specifies how many less significant digits to be displayed for the
        auxiliary (non-coefficient) statistics. The default is less(0), meaning no less.

    decmark( ) contains the decimal marker; default decmark(.)


    fixed decimals & formats

        dec(#) or fmt(type) for everything, default dec(3) and fmt(fc)

        where # is fixed decimals between 0 and 11,
        and type is one of the following:

         e   exponential
         f   fixed
         fc  fixed with commas for thousands
         g   general
         gc  general with commas for thousands

        Use the following only if you want them different from dec(#) or fmt(type):

        bdec(#) or bfmt(type) for coefficient only
        sdec(#) or sfmt(type) for standard error
        tdec(#) or tfmt(type) for t-statistics
        pdec(#) or pfmt(type) for p-value
        cdec(#) or cfmt(type) for conf. interval
        rdec(#) or rfmt(type) for r-square
     adec(#) or afmt(type) for addstat( ) contents





9
pineberries 学生认证  发表于 2022-10-13 21:37:45
local tstat=r(estimate)/r(se)
local pval = tprob(r(df), abs(`tstat'))
outreg2 [m*] using results,adds(joint, r(estimate), t-stat, `tstat', p-val,`pval') bdec(3) excel replace e(r2_a)

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

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