我正在尝试将Stata的回归结果导出到Excel。
xtreg index_bhar adsue1 i.date, fe cluster(company_id) dfadj
estimates store FTFE1,title("Stock FTFE DSUE1")
xtreg index_bhar adsue2 i.date, fe cluster(company_id) dfadj
estimates store FTFE2,title("Stock FTFE DSUE2")
xtreg index_bhar adsue3 i.date, fe cluster(company_id) dfadj
estimates store FTFE3,title("Stock FTFE DSUE3")
esttab using BHAR_regression_csv.csv, cells(b(star fmt(%9.5f)) se(par fmt(%9.5f))) drop(_Idate*) stats(N ar2)
最后一步不起作用,无论"如何"我删除i.date
变量。我试过了:
_Idate*
*date*
i.date
*_date_*
此外,我想添加文字(例如outreg2
(http://dss.princeton.edu/training/Outreg2.pdf),因为我要比较FE与RE和OLS。
我跑
xtreg index_bhar adsue3 i.date, fe cluster(company_id) dfadj
matrix list r(table)
which esttab
并获得以下结果:
r(table)[9,37]
177b. 178. 179. 180. 181. 182. 183. 184. 185. 186.
adsue3 date date date date date date date date date date
b .06636876 0 -.00551558 -.01558847 -.01223474 -.02825648 -.01797169 -.02353377 -.02351679 -.03266691 -.0270249
se .00547756 . .00742083 .00708063 .00731967 .0070688 .0064812 .00733153 .00801699 .00725142 .00718932
t 12.116494 . -.743256 -2.2015648 -1.6714891 -3.9973525 -2.7728929 -3.2099395 -2.9333704 -4.5048967 -3.7590343
pvalue 2.123e-29 . .45771891 .0282086 .09532812 .00007497 .00578939 .00142372 .00352624 8.497e-06 .00019331
ll .05560367 . -.02009981 -.0295041 -.02662015 -.04214886 -.03070926 -.0379425 -.03927265 -.04691819 -.04115414
ul .07713385 . .00906865 -.00167284 .00215067 -.01436411 -.00523411 -.00912505 -.00776093 -.01841562 -.01289566
df 445 445 445 445 445 445 445 445 445 445 445
crit 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092
eform 0 0 0 0 0 0 0 0 0 0 0
187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197.
date date date date date date date date date date date
b -.01494385 -.04620886 -.0555639 -.03572873 -.02022551 -.04343248 -.02897542 .00823335 .00360491 -.03832982 .01898826
se .00767353 .00702574 .00719699 .00910337 .00841343 .00953967 .01449665 .01373734 .01801534 .00976289 .01180829
t -1.9474554 -6.5770847 -7.7204359 -3.9247818 -2.403956 -4.5528285 -1.9987665 .59934072 .20010199 -3.9260751 1.6080448
pvalue .05210873 1.349e-10 7.722e-14 .00010055 .01662665 6.841e-06 .04624143 .54925071 .84149223 .00010003 .10853459
ll -.03002471 -.0600166 -.06970821 -.05361967 -.0367605 -.06218089 -.05746582 -.01876477 -.03180081 -.05751691 -.00421868
ul .000137 -.03240112 -.04141959 -.0178378 -.00369052 -.02468408 -.00048502 .03523146 .03901062 -.01914273 .04219519
df 445 445 445 445 445 445 445 445 445 445 445
crit 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092
eform 0 0 0 0 0 0 0 0 0 0 0
198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208.
date date date date date date date date date date date
b -.00349209 .01009475 -.05471275 -.02974371 -.02135717 -.02611022 -.03897832 -.05436064 -.01511528 -.04263671 -.03508992
se .00784112 .01076697 .00854308 .00684135 .00770194 .00762225 .00711017 .01004461 .00849691 .00786062 .00874839
t -.44535604 .93756631 -6.4043313 -4.3476349 -2.7729599 -3.4255286 -5.4820548 -5.4119214 -1.7789158 -5.4240873 -4.0110133
pvalue .65627905 .34897589 3.845e-10 .00001707 .00578822 .00067052 7.057e-08 1.021e-07 .07593611 9.579e-08 .00007091
ll -.01890232 -.01106568 -.07150255 -.04318909 -.03649387 -.04109029 -.05295199 -.0741014 -.03181434 -.05808527 -.05228321
ul .01191814 .03125518 -.03792294 -.01629833 -.00622048 -.01113015 -.02500464 -.03461988 .00158377 -.02718815 -.01789662
df 445 445 445 445 445 445 445 445 445 445 445
crit 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092 1.9653092
eform 0 0 0 0 0 0 0 0 0 0 0
209. 210. 211.
date date date _cons
b -.0238768 -.00742588 -.02083166 -.00432197
se .00831877 .00967837 .0094757 .00546817
t -2.8702321 -.76726574 -2.198429 -.79038681
pvalue .00429722 .44333042 .02843267 .4297229
ll -.04022575 -.02644688 -.03945434 -.01506861
ul -.00752784 .01159511 -.00220897 .00642467
df 445 445 445 445
crit 1.9653092 1.9653092 1.9653092 1.9653092
eform 0 0 0 0
. which esttab
c:\ado\plus\e\esttab.ado
*! version 2.0.6 02jun2014 Ben Jann
*! wrapper for estout
我正在使用Stata / SE 12.0。
我已运行代码但结果相同,Stata无法找到系数* .date。
答案 0 :(得分:1)
您没有指定确切的错误。据推测:
未找到系数
R(111);
但我真的不明白你说过你曾经尝试过的。
使用因子表示法创建的虚拟变量具有以下形式:num.varname
,因此drop
ping *.varname
就足够了。一个荒谬的例子:
clear all
set more off
*----- example data -----
sysuse auto
*----- what you want -----
eststo clear
eststo: quietly regress price weight mpg
eststo: quietly regress price weight mpg i.foreign
esttab, ar2 title(Model Comparison for Price) ///
mtitles("first model" "second model") drop(*.foreign)
我无法打开您提供的链接,但请考虑使用title()
和mtitles()
选项在表格中引入文字(也会举例说明)。添加using ...
以导出到.csv
。
您的代码存在的一个问题是,您没有使用eststo
来存储结果,而是estimates store
。这是有效的,但是当您调用esttab
时,您必须明确列出存储结果的名称。如果不这样做,则esttab
将仅使用最后一次拟合的模型的结果(无论是否使用estimates store
保存它们)。例如,这可以按预期工作:
clear all
set more off
*----- example data -----
sysuse auto
*----- what you want -----
estimates clear
quietly regress price weight mpg
estimates store first
quietly regress price weight mpg i.foreign
estimates store second
esttab first second, ar2 title(Model Comparison for Price) ///
mtitles("first model" "second model") drop(*.foreign)
这意味着,您的代码仅使用最后一个可用结果:
xtreg index_bhar adsue3 i.date, fe cluster(company_id) dfadj
但是在这里,我怀疑选项drop(*.date)
应该有效。
尝试运行此功能并在原始帖子中报告确切结果:
xtreg index_bhar adsue3 i.date, fe cluster(company_id) dfadj
matrix list r(table)
esttab, ar2 title(Model Comparison) ///
mtitles("first model") drop(*.date)