Statalist


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

Re: st: esta: how to stratify model types in rows


From   "Ben Jann" <[email protected]>
To   [email protected]
Subject   Re: st: esta: how to stratify model types in rows
Date   Mon, 22 Oct 2007 10:24:02 +0200

Michael,
-esttab- (and -estout-) cannot tabulate models beneath one another -
one model one column. There are two approaches to achieve the desired
result. Both are somewhat involved.

1) Use two calls to esttab/estout to produce your table. Example:

. sysuse auto, clear
(1978 Automobile Data)

. eststo clear

. eststo: regress price weight if price <7000
(est1 stored)

. eststo: regress price weight if price >7000
(est2 stored)

. eststo: regress price weight mpg if price <7000
(est3 stored)

. eststo: regress price weight mpg if price >7000
(est4 stored)

. esttab est1 est2 using temp.smcl, se brackets drop(_cons) ///
>         noobs postfoot("") replace ///
>         mtitles("pr<7000" "pr>7000")
(output written to temp.smcl)

. esttab est3 est4 using temp.smcl, se brackets drop(mpg _cons) ///
>         prehead("{...}") posthead("{...}") nonumbers nomtitles ///
>         append coeflab(weight "weight (mpg)")
(output written to temp.smcl)

. type temp.smcl
--------------------------------------------
                      (1)             (2)
                  pr<7000         pr>7000
--------------------------------------------
weight              0.316           1.673*
                  [0.168]         [0.749]

weight (mpg)      0.00936           1.301
                  [0.280]         [1.052]
--------------------------------------------
N                      58              16
--------------------------------------------
Standard errors in brackets
* p<0.05, ** p<0.01, *** p<0.001


2) Construct combined results from the single models, save them in e()
(similar to multiple equation models), and then tabulate these
"supermodels". For an example see:

http://www.stata.com/statalist/archive/2007-06/msg00636.html

ben

On 10/21/07, Michael McCulloch <[email protected]> wrote:
> Hello, I'm inquiring whether esta can be set to display two different
> models, of two different comparisons. I'll illustrate using Stata's
> auto.dta. I'm going to examine the influence of weight on price: with
> and without mpg, in price range above and below $7,000.
>
> The code below will display the four models in each of four columns:
>         A B C D
>
> However, I'd like to learn how to display them as:
>         A B
>         C D
>
> sysuse auto, clear
> esto clear
> esto: regress price weight if price <7000
> esto: regress price weight if price >7000
> esto: regress price weight mpg if price <7000
> esto: regress price weight mpg if price >7000
>
> esta, se brackets drop(mpg _cons) ///
>         mtitles("<$7,000" ///
>         ">$7,000" ///
>         "<$7,000, mpg" ///
>         ">$7,000, mpg")
> *
> *   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/
>
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index