2

有没有办法在eststo命令和命令之间保存和重新加载数据esttab

我想要的是以下内容:

eststo: quietly reg a b
estsave using foo.est, replace

***

*Some other File
estload using foo.est
esttab foo.tex

任何其他让我通过反复试验来输出回归的方式的替代方案(无需重新运行它们并且必须在交互式提示下)将非常有帮助。

4

2 回答 2

2

Why do you need to put it to disk?

The (prefix) command eststo stores the results in memory until you close the file, and unless specified names each estimate consecutively (eststo1, eststo2 etc.). You can re-program and re-run only part of the do file.

Alternatively, you could create all estimates in a do and call it from a secondary do:

/* .do for make tables */
do makeEstimates.do
esttab ...

Elsewhere you program makeEstimates.do:

/* .do to make estimates */
quietly regress a b
estout ab

You can run once, then comment out the do makeEstimates.do line to just work on estout if you do not change them.

于 2013-01-07T21:26:52.460 回答
0

estimates save您可以使用以下命令将估计值存储在磁盘上:

sysuse auto, clear

quietly regress price mpg
estimates save foo1

quietly regress price trunk
estimates save foo2

quietly regress price weight
estimates save foo3

上面的代码片段3在您当前的工作目录中创建了包含估计值的文件:

foo1.ster
foo2.ster
foo3.ster

然后,您可以重新加载这些并以esttab非交互方式使用它们,并以您喜欢的任何方式使用estimates use命令:

estimates use foo2
esttab .

----------------------------
                      (1)   
                    price   
----------------------------
trunk               216.7** 
                   (2.81)   

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

estimates use foo1
esttab .

----------------------------
                      (1)   
                    price   
----------------------------
mpg                -238.9***
                  (-4.50)   

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

estimates use foo3
esttab .

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

_cons              -6.707   
                  (-0.01)   
----------------------------
N                      74   
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
于 2019-04-05T20:24:43.287 回答