Reputation: 2825
I tried creating a table using the community-contributed family of commands estout
:
esttab est1 est2 est3 using table3.tex, se label nobaselevels ///
star(* 0.10 ** 0.05 *** 0.01) cell((coef(fmt(%9.2f)) sd(fmt(%9.2f)))) ///
drop(_Iprovince* _Iyear*) stats(year province robust r2 N, ///
label("Year Fixed Effects" "Province Fixed Effects" "Robust SE" "R-squared")) ///
replace booktabs
However, Stata produces the following error:
coefficient _Iprovince* not found
These are "fixed effect" dummies that I want to drop them out.
The code works fine when I take out cell()
.
Finally, how can I also round up the coefficient estimates and standard errors?
Upvotes: 0
Views: 3899
Reputation:
The code does not execute because you are using in esttab
the suboption sd
instead of se
:
sysuse auto, clear
eststo est1: xi: reg price mpg i.rep78
i.rep78 _Irep78_1-5 (naturally coded; _Irep78_1 omitted)
Source | SS df MS Number of obs = 69
-------------+---------------------------------- F(5, 63) = 4.39
Model | 149020603 5 29804120.7 Prob > F = 0.0017
Residual | 427776355 63 6790100.88 R-squared = 0.2584
-------------+---------------------------------- Adj R-squared = 0.1995
Total | 576796959 68 8482308.22 Root MSE = 2605.8
------------------------------------------------------------------------------
price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
mpg | -280.2615 61.57666 -4.55 0.000 -403.3126 -157.2103
_Irep78_2 | 877.6347 2063.285 0.43 0.672 -3245.51 5000.78
_Irep78_3 | 1425.657 1905.438 0.75 0.457 -2382.057 5233.371
_Irep78_4 | 1693.841 1942.669 0.87 0.387 -2188.274 5575.956
_Irep78_5 | 3131.982 2041.049 1.53 0.130 -946.7282 7210.693
_cons | 10449.99 2251.041 4.64 0.000 5951.646 14948.34
------------------------------------------------------------------------------
esttab est1, cell((coef(fmt(%9.2f)) sd(fmt(%9.2f)))) label nobaselevels ///
star(* 0.10 ** 0.05 *** 0.01) stats(b r2 N) drop(_Irep78*)
coefficient _Irep78* not found
r(111);
If you use the correct suboption se
the code runs:
esttab est1, cell((coef(fmt(%9.2f)) se(fmt(%9.2f)))) label nobaselevels ///
star(* 0.10 ** 0.05 *** 0.01) stats(r2 N) drop(_Irep78*)
----------------------------------------------
(1)
Price
coef se
----------------------------------------------
Mileage (mpg) 61.58
Constant 2251.04
----------------------------------------------
r2 0.26
N 69.00
----------------------------------------------
However, the suboption coeflabels
(coef
in your code) is supposed to only
specify labels for beta coefficients, not include them.
As such, instead you need to use the suboption b
as suggested in
@Dimitriy's answer:
esttab est1, cell((b(fmt(%9.2f)) se(fmt(%9.2f)))) label nobaselevels ///
star(* 0.10 ** 0.05 *** 0.01) stats(r2 N) drop(_Irep78*)
----------------------------------------------
(1)
Price
b se
----------------------------------------------
Mileage (mpg) -280.26 61.58
Constant 10449.99 2251.04
----------------------------------------------
r2 0.26
N 69.00
----------------------------------------------
Here's the full output in esttab
(wihout dropping anything):
esttab est1, cell((b(fmt(%9.2f)) se(fmt(%9.2f)))) label nobaselevels ///
star(* 0.10 ** 0.05 *** 0.01) stats(r2 N)
----------------------------------------------
(1)
Price
b se
----------------------------------------------
Mileage (mpg) -280.26 61.58
rep78==2 877.63 2063.28
rep78==3 1425.66 1905.44
rep78==4 1693.84 1942.67
rep78==5 3131.98 2041.05
Constant 10449.99 2251.04
----------------------------------------------
r2 0.26
N 69.00
----------------------------------------------
Upvotes: 1
Reputation: 9470
Unless you have a very old version of Stata, don't use xi
to create your FEs. Use factor variable notation i.province
and i.year
instead.
The principal problem with your code is that you should have b
instead of coef
(Stata cannot drop coefficients since they are not included unless you tell Stata that you want them):
sysuse auto
eststo est1: reg price mpg i.rep78
esttab est1, ///
stats(b year province robust r2 N, label("Year Fixed Effects" "Province Fixed Effects" "Robust SE" "R-squared")) ///
replace booktabs drop(*.rep78) se label nobaselevels star(* 0.10 ** 0.05 *** 0.01) cell((b(fmt(%9.2f)) sd(fmt(%9.2f))))
Note the reproducible example on a shared dataset.
Upvotes: 1