Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Lance Erickson <lance_erickson@byu.edu> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: RE: RE: column headings using estout |

Date |
Wed, 6 Jun 2012 21:50:35 +0000 |

If you're worried about accuracy and efficiency then I imagine you're working with some sort of loop. Aside from any statistical concerns I can imagine hearing from statalist members about working with that many outcomes, it really would be the way to go. Here's a solution that I think should work that local macros and a loop. Even this could be more efficient if you wanted to loop through sets of independent variables. I added another dependent variable just for kicks. sysuse auto, clear local i = 1 foreach v of varlist price mpg rep78 { eststo m`i': reg `v' foreign local mgroups "`mgroups' `e(depvar)'" local pattern "`pattern' 1" local mlabel "`mlabel' origin" local models "`models' m`i'" local ++i eststo m`i': reg `v' foreign weight length local mgroups "`mgroups' `e(depvar)'" local pattern "`pattern' 1" local models "`models' m`i'" local mlabel "`mlabel' physical" local ++i } estout `models', /// mgroups(`mgroups', pattern(`pattern')) /// mlabel(`mlabel') /// collabel(none) Best, Lance -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of David Sikkink Sent: Wednesday, June 06, 2012 12:00 PM To: statalist@hsphsun2.harvard.edu Subject: st: RE: RE: column headings using estout Thanks, Lance. This gets me part of the way. The difficulty is that I have over 200 separate regressions in the do file (why I need that many is a long story, so to speak). As I understand your syntax, it is not directing estout to grab the dependent variable name for each regression but is providing the names directly for estout to use (in the mgroups command). I could do that, but it would be prone to error and tedious with the number of regressions that I am running. It looks like the same problem would apply to the mlabel command below. I need "origin" and "physical" to be "called" in a sense when the appropriate nested model is being run. Else I would have to string together "origin physical" over 100 times and stick the result in the mlabel command. It would work, but would not be as flexible as having a connection between the particular nested model being run and a particular heading. (In outreg2, this was easy to do using -estimates store Origin- and -estimates store Physical- etc., but -estimates store- and outreg2 does not work with -mi estimate, post-, and outreg2 has some issues dealing with a mix of different types of regressions, ologit, logit, reg, in the same output file.) Thanks for your help. Your answer is giving me something to work with. Any other ideas? --David PS: Here is what I used to do in outreg2, and would like to do in estout (using "origin" and "physical" as examples). reg depvar1 indepvar1 indepvar2 estimates store Origin reg depvar1 indepvar1 indepvar2 indepvar3 indepvar4 estimates store Physical outreg2 [Origin Physical] using FileA reg depvar2 indepvar1 indepvar2 estimates store Origin reg depvar2 indepvar1 indepvar2 indepvar3 indepvar4 estimates store Physical outreg2 [Origin Physical] using FileA This would append the results from the second depvar regressions to FileA, maintaining the depvar names as headers and the "origin" and "physical" as the subheadings for the appropriate nested regression. -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Lance Erickson Sent: Wednesday, June 06, 2012 12:18 PM To: statalist@hsphsun2.harvard.edu Subject: st: RE: column headings using estout Hi David, Here's one potential solution... sysuse auto, clear eststo m1: reg price foreign eststo m2: reg price foreign weight length eststo m3: reg mpg foreign eststo m4: reg mpg foreign weight length estout m1 m2 m3 m4, /// mgroups(price price mpg mpg, pattern(1 1 1 1)) /// mlabel(origin physical origin physical) /// collabel(none) Best, Lance -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of David Sikkink Sent: Wednesday, June 06, 2012 6:06 AM To: statalist@hsphsun2.harvard.edu Subject: st: column headings using estout I am running a series of nested regression models and storing the estimates using eststo. I would like to have a heading and subheading for each column of regression coefficients in the output from estout. I want the top heading to be the dependent variable name, and the subheading to indicate the particular nested model represented in the column (e.g., "Demographics", "Add Political Party" etc.). Multiple dependent variables will be run and included, but the subheadings will repeat for the nested regressions of each dependent variable. The result should look like this: DepVar1 DepVar1 DepVar2 DepVar2 Demographics Add Pol Party Demographics Add Pol Party IndVar1 1.2 1.1 .9 .8 IndVar2 3.2 2.8 2.5 2.2 IndVar3 .6 .3 IndVar4 4.2 3.8 Thanks for any direction you can offer. --David * * 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/ * * 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**:**st: RE: RE: RE: RE: column headings using estout***From:*Lance Erickson <lance_erickson@byu.edu>

**References**:**st: column headings using estout***From:*David Sikkink <David.Sikkink.1@nd.edu>

**st: RE: column headings using estout***From:*Lance Erickson <lance_erickson@byu.edu>

**st: RE: RE: column headings using estout***From:*David Sikkink <David.Sikkink.1@nd.edu>

- Prev by Date:
**st: Csgof does not count var categories with zero observations** - Next by Date:
**Re: st: Questions about xtsur, heteroskedasticity, and auto-correlation** - Previous by thread:
**st: RE: RE: column headings using estout** - Next by thread:
**st: RE: RE: RE: RE: column headings using estout** - Index(es):