组合esttab中线性和非线性回归的输出

时间:2019-07-19 12:24:36

标签: stata

我使用社区贡献的命令esttab显示两次回归的结果:

sysuse auto, clear

quietly reg price weight
est store ols

quietly nl (price = {b0} + {b1} * weight)
est store nls

esttab *

--------------------------------------------
                      (1)             (2)   
                    price           price   
--------------------------------------------
main                                        
weight              2.044***                
                   (5.42)                   

_cons              -6.707          -6.707   
                  (-0.01)         (-0.01)   
--------------------------------------------
b1                                          
_cons                               2.044***
                                   (5.42)   
--------------------------------------------
N                      74              74   
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

如何通过b1命令使nl系数出现在weight行中?

1 个答案:

答案 0 :(得分:1)

最简单的方法如下:

sysuse auto, clear
estimates clear

regress price weight
estimates store ols

nl (price = {b0} + {b1} * weight)

matrix b = e(b)
matrix V = e(V)

matrix coleq b = " "
matrix coleq V = " "

matrix colnames b = _cons weight
matrix colnames V = _cons weight

erepost b = b V = V, rename
estimates store nls

结果:

esttab ols nls


--------------------------------------------
                      (1)             (2)   
                    price           price   
--------------------------------------------
weight              2.044***        2.044***
                   (5.42)          (5.42)   

_cons              -6.707          -6.707   
                  (-0.01)         (-0.01)   
--------------------------------------------
N                      74              74   
--------------------------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001

请注意,erepost社区贡献的命令,您可以从SSC下载:

ssc install erepost