欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Stata 回归表格输出

程序员文章站 2022-04-11 15:35:21
...
xtset stkcd year
encode industry , gen(ind)

global x1 "   " //解释变量
global x2 "   " //解释变量
global x3 "  " //解释变量
global cv " " //控制变量
global i "i.ind i.year "   //行业固定效应、年份固定效应

* 表4 OLS
local out1 " "  //被解释变量
local out2 " "  //被解释变量

qui xi: reg `out1'  $x1 $cv $i , robust
est store m1
qui xi: reg `out1'  $x2 $cv $i , robust 
est store m2
qui xi: reg `out1'  $x3 $cv $i , robust
est store m3
qui xi: reg `out2'  $x1 $cv $i , robust 
est store m4
qui xi: reg `out2'  $x2 $cv $i , robust
est store m5
qui xi: reg `out2'  $x3 $cv $i , robust
est store m6
local model "m1 m2 m3 m4 m5 m6  "
esttab `model', mtitle(`model') replace   ///
	  b(%6.3f)  se(%6.2f)   ///
                  star(* 0.1 ** 0.05 *** 0.01)     ///
                  scalar(F r2_a N N_g)  order()   ///
				  compress nogaps indicate("Year FE = *Iyear*" "Industry FE = *Iind*")
				  
esttab `model' using 表4_XX与XX.rtf, replace  ///
			  mtitle(`model') compress nogaps title("Table 4 OLS")  star(* 0.1 ** 0.05 *** 0.01)  b(%6.3f) se(%6.2f)   ///
			  scalar(F r2_a N )  indicate("Year FE = _Iyear_*" "Industry FE = _Iind_*" )  ///
			  addnotes("" "")  order( )  //空两行 
			  
**表5 FE
local out1 " "  //被解释变量
local out2 " "  //被解释变量

qui xi: xtreg `out1'  $x1 $cv $i , fe
est store m1
qui xi: xtreg `out1'  $x2 $cv $i , fe
est store m2
qui xi: xtreg `out1'  $x3 $cv $i , fe
est store m3
qui xi: xtreg `out2'  $x1 $cv $i , fe
est store m4
qui xi: xtreg `out2'  $x2 $cv $i , fe
est store m5
qui xi: xtreg `out2'  $x3 $cv $i , fe
est store m6
local model "m1 m2 m3 m4 m5 m6  "
esttab `model', mtitle(`model') replace   ///
	 b(%6.3f)  se(%6.2f)   ///
                  star(* 0.1 ** 0.05 *** 0.01)     ///
                  scalar(F r2_a N N_g)  order()   ///
				  compress nogaps indicate("Year FE = *Iyear*" "Industry FE = *Iind*")
				  
esttab `model' using 表4_XX与XX.rtf, append  ///
			   mtitle(`model') compress nogaps title("Table 5 FE")  star(* 0.1 ** 0.05 *** 0.01)  b(%6.3f) se(%6.2f)   ///
			  scalar(F r2_a N )  indicate("Year FE = _Iyear_*" "Industry FE = _Iind_*" )  ///
			  addnotes("" "") order( )   //空两行 
			  
相关标签: stata statistics