Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Jesper Lindhardsen" <[email protected]> |

To |
<[email protected]> |

Subject |
RE: st: Two way table of regression coefficients or intercepts with -esttab- |

Date |
Sun, 25 Sep 2011 20:45:46 +0200 |

```
Hi Richard,
I would use -estout- with the append option, and regress (or other commands) in the relevant subgroups through loop.
Building on your own example, something like this.....
eststo clear
levelsof a_q,local(l_a_q)
levelsof b_q,local(l_b_q)
capture erase yo.txt
foreach l_a of local l_a_q {
est clear
foreach l_b of local l_b_q {
eststo e_`l_a'_`l_b': reg c if a_q==`l_a' & b_q==`l_b'
}
estout * using yo.txt, append collabel(none)
}
If the command you want to use do not return estimate(eg summarize), then you can use -estpost- to make up for for this...
In my experience, it not worth the effort to rely on any output command to give you a perfect final table. IMHO, It's way easier to get the results in the right rows and columns, and then use excel or other spreadsheets as an intermediary before a wordprocessor.
HTH, Jesper
Jesper Lindhardsen
MD, PhD candidate
Department of Cardiovascular Research
Copenhagen University Hospital, Gentofte
Denmark
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Richard Herron
Sent: 23 September 2011 16:28
To: [email protected]
Subject: Re: st: Two way table of regression coefficients or intercepts with -esttab-
-esttab- and -eststo- are from the -estout- package.
http://repec.org/bocode/e/estout/index.html
Thanks!
On Fri, Sep 23, 2011 at 10:07, Nick Cox <[email protected]> wrote:
> Please remember the request to explain where user-written commands you
> refer to come from.
>
> Nick
>
> On Fri, Sep 23, 2011 at 2:58 PM, Richard Herron
> <[email protected]> wrote:
>> Can I make a two-way table of regression coefficients with -esttab-?
>> Sometimes I like to make a two-way table with either intercepts or
>> coefficients and I would like to automate it.
>>
>> For example, here I generate three random variables, then form
>> quintiles on -a- and -b-, then find the mean of -c- in each of the 25
>> groups (intersections of -a_q- and -b_q-) with -regress-. This is
>> fairly easy with -table-, but is less extensible to displaying
>> intercepts, significance, etc (and I am not sure how to generate a
>> LaTeX table from -table-). Can I so this with -esttab- or -estout-?
>>
>> Thanks!
>>
>> * --- begin code ---
>>
>> * generate data
>> clear
>> set obs 2000
>> generate a = rnormal()
>> generate b = rnormal()
>> generate c = rnormal()
>>
>> * generate quantiles for for a and b
>> xtile a_q = a, nquantiles(5)
>> xtile b_q = b, nquantiles(5)
>>
>> * I would like something like this two-way table of means, but that is
>> extensible to intercepts and/or more coefficients
>> table a_q b_q, c(mean c)
>>
>> * but the best I can do is this very wide table that is not very readable
>> eststo clear
>> bysort a_q b_q: eststo: quietly regress c
>> esttab, not noconstant nogap compress
>>
>> * --- end code ---
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
```

**Follow-Ups**:**Re: st: Two way table of regression coefficients or intercepts with -esttab-***From:*Richard Herron <[email protected]>

**References**:**st: Two way table of regression coefficients or intercepts with -esttab-***From:*Richard Herron <[email protected]>

**Re: st: Two way table of regression coefficients or intercepts with -esttab-***From:*Nick Cox <[email protected]>

**Re: st: Two way table of regression coefficients or intercepts with -esttab-***From:*Richard Herron <[email protected]>

- Prev by Date:
**st: Spike for DB CV data** - Next by Date:
**st: Re;pwcompare, repeated measures and xtmixed** - Previous by thread:
**Re: st: Two way table of regression coefficients or intercepts with -esttab-** - Next by thread:
**Re: st: Two way table of regression coefficients or intercepts with -esttab-** - Index(es):