Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: estount and xtmixed?


From   "Ben Jann" <ben.jann@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: estount and xtmixed?
Date   Wed, 15 Nov 2006 16:08:47 +0100

Guido encountered two problems when applying -estout- to -xtmixed- results.

Problem 1: renaming the random effects equations.

Applying estout to xtmixed produces output such as the following:

. use http://www.stata-press.com/data/r9/pig
. qui xtmixed weight week || id:
. estout, style(fixed)

                       b
weight
week             6.209896
_cons            19.35561
lns1_1_1
_cons            1.358731
lnsig_e
_cons            .7402006

Renaming the equations can be done using the -eqlabels()- obtion,
specifying labels for all equations one after another, e.g.:

. estout, eqlab("weight" "L2 RI" "L1 error") style(fixed)

                       b
weight
week             6.209896
_cons            19.35561
L2 RI
_cons            1.358731
L1 error
_cons            .7402006

This looks messy, admittedly, but it can be cleaned up by specifying
the -none- suboption within -eqlabels()- (requires the newest -estout-
update):

. estout, eqlab("" "L2 RI" "L1 error", none) style(fixed)

                       b
week             6.209896
_cons            19.35561
L2 RI            1.358731
L1 error         .7402006

Furthermore, ordering can be changed using the -order()- option. For example:

. estout, eqlab(""  "L1 error" "L2 RI", none)  ///
 order(weight: lnsig_e:) style(fixed)
                       b
week             6.209896
_cons            19.35561
L1 error         .7402006
L2 RI            1.358731


Problem 2: display standard deviations of random effects  (incl.
standard errors) instead of log of standard deviations.

The -eform- option may be used to transform ln(sd) to sd and also
transform the standard errors accordingly. Example:

. estout, cell("b se") eqlab(,none) style(fixed) eform

                       b           se
week             497.6494     19.43982
_cons            2.55e+08     1.54e+08
lns1_1_1         3.891253     .4143198
lnsig_e          2.096356     .0757444

A problem is that the coefficients in the main equation are being
transform, too! It would be great if the -eform- would allow choosing
the equations/coefficients to be transformed, but this is not
currently implemented. However, I can offer a workaround: use two
calls to -estout- to produce the table. Here is an example:

. estout using test.txt, keep(weight:) cell("b se") eqlab(,none) style(fixed)
. estout using test.txt, drop(weight:) eform mlab(,none) collab(,none)
append ///
cell("b se") eqlab(,none) style(fixed)
. type test.txt

                       b           se
week             6.209896     .0390633
_cons            19.35561      .603139
lns1_1_1         3.891253     .4143198
lnsig_e          2.096356     .0757444

ben

On 11/15/06, Tiemann, Guido <gt@mpifg.de> wrote:
Hi all!

I would like to ask for some help regarding a problem with "estout" and
"xtmixed". I have estimated several multilevel models using "xtmixed",
and after that I have tried to export the resulting tables to LaTeX.
Unfortunately, displaying the random effects part was somewhat
problematic, as I was (1) not able to properly rename the equations
which refer to the different levels of my models (lns_1_1_1 etc.). In
addition, I would (2) like to include the standard deviations of the
random effects (just as they are produced in the xtmixed output), but
unfortunately I could only acquire their logs from the
variance-covariance matrix. Hence, is there any convenient way to make
estout present the original estimates?

Any help regarding these two questions would be greatly appreciated.
Best regards,

Guido Tiemann




Here is my "estout" syntax:


estout m1 m2 m3 m4 m5 m6 using "TAB1.tex", replace style(tex)
cells(b(star fmt(%9.2f)) se(par)) starlevels(^* .05 ^{**} .01 ^{***}
.001) stats(N r2 F aic bic rmse, labels("N" "R-squared" "F-Test" "AIC"
"BIC" "MSE")) prehead(\begin{table}[htbp] \small \centering
\caption{\label{TAB1}Tabelle} \begin{tabular}[t]{l*{@M}{d{6}}} \toprule)
posthead("\midrule") prefoot("\midrule") postfoot(\bottomrule
\end{tabular} \parbox{\textwidth}{\emph{Notes:}.}
\end{table})
label collabels(,none)
     eqlabels   (lnsig_e "Level 1, error (log.)"
                 lns1_1_1 "Level 2, RI (log.)"
                 lns1_1_2 "Level 2, RC1 (log.)"
                 lns1_1_3 "Level 2, RC2 (log.)"
                 lns2_1_1 "Level 3, RI (log.)")
                 ,none)
     varlabels  (eb_LR "Left-Right"
                 eb_LR_2 "Left-Right (squared)"
                 _cons "Constant"
                 ) ;

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index