Reputation: 329
Does anyone know if it is possible to use the magnificent "indicate()" option in esttab
with xtreg
?
If I run a regression like
eststo MYREG: reg y x i.category,
then I can do
esttab MYREG , indicate("Category FE = *.category")
and I will get a nice table like so:
----------------------
x 2.3443
(2.15)
Category FE Yes
----------------------
N 4321
----------------------
THE PROBLEM: When I use
xtset category
xtreg y x
there is no coefficient saved that I can use in the indicate statement. Or is there? I have been unable to find any.
I realize that I can use
estadd local fe "Yes" : MYREG
and then I can get a table like
esttab MYREG , stats(N fe)
----------------------
x 2.3443
(2.15)
----------------------
N 4321
Category FE Yes
----------------------
but I am using a bunch of other "i.VAR" type fixed effects and I want them all to show up together just below the coefficients and not have just one of them showing up in the footer.
Upvotes: 4
Views: 6605
Reputation: 158
The quickest thing to do is to insert arbitrary lines of text/smcl/latex using the varlist
option. For example to insert a line noting a FE right before _cons
(rather than down in the stats panel), use
esttab myreg, stats(N) varlabels(,blist(_cons "{p2col 0 20 0 0: FE}yes{p_end}"))
Which will display:
----------------------------
(1)
weight
----------------------------
week 6.210***
(158.97)
FE yes
_cons 19.36***
(32.09)
----------------------------
N 432
----------------------------
t statistics in parentheses
* p<0.05, ** p<0.01, *** p<0.001
You can adjust the 20
to get the right horizontal layout, or just use spaces (which is what you'll do if you have more than a single model.
If you want something more robust (that can handle model re-ordering) the alternative is to edit each model estimate and put in fake entries in the e(b) (and e(V)) matrices and then use indicate when you output the table. Here is a simple ado I've used:
*Needs erepost
program add_fake_coeff_to_e, eclass
args cname cval
tempname eb eb2 eV eV2
mat `eb' = e(b)
local eb_names : colnames `eb'
mat `eb2' = `eb', `cval'
matrix colnames `eb2' = `eb_names' `cname'
*Need the dimensions of V to match b
mat `eV' = e(V)
local num_eb : word count `eb_names'
mat `eV2' = I(`=`num_eb'+1')
mat `eV2'[1,1] = `eV'
matrix colnames `eV2' = `eb_names' `cname'
matrix rownames `eV2' = `eb_names' `cname'
erepost b=`eb2' V=`eV2'
end
So then you would do
reg blah
add_fake_coeff_to_e "FE" 1
estimates store est1
esttab est1 , <other opts> indicate("FE", labels("Y" ""))
Upvotes: 2