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

From |
Howard Lempel <HLempel@brookings.edu> |

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

Subject |
RE: st: estout matrix - super column names |

Date |
Sun, 1 Feb 2009 23:21:52 -0500 |

Ben, Thanks! The second method does exactly what I wanted. I didn't know about the -ereturn post- command at all. Howie ________________________________________ From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Ben Jann [ben.jann@gmail.com] Sent: Friday, January 30, 2009 4:23 PM To: statalist@hsphsun2.harvard.edu Subject: Re: st: estout matrix - super column names Matrix mode in -estout- is limited. One approach, however, would be to use a different layout for the matrix so that the groups are different row equations, and then use -unstack- in -estout-. Example: . mat A = (1, 2) \ (3, 4) . mat coln A = 1979 2007 . mat rown A = male:mystat female:mystat . estout matrix(A), unstack ---------------------------------------------------------------- A male female 1979 2007 1979 2007 ---------------------------------------------------------------- mystat 1 2 3 4 ---------------------------------------------------------------- A more flexible approach is to post the contents of the matrix into several "estimation sets" and then use -estout- in normal, non-matrix mode. Example (Stata 9 or newer required): . mat A = (1,2,3,4) . mat coln A = male:1979 male:2007 female:1979 female:2007 . mat rown A = mystat . mat tmp = A[1...,"male:"]' . ereturn post . estadd matrix A = tmp added matrix: e(A) : 2 x 1 . eststo male . mat tmp = A[1...,"female:"]' . ereturn post . estadd matrix A = tmp added matrix: e(A) : 2 x 1 . eststo female . estout male female, cell((A["1979"] A["2007"])) ---------------------------------------------------------------- male female 1979 2007 1979 2007 ---------------------------------------------------------------- mystat 1 2 3 4 ---------------------------------------------------------------- Note that the results are transposed for posting them (apostrophe at the end of the definition of matrix tmp). Without transposing, the syntax would be: . mat tmp = A[1...,"male:"] . ereturn post . estadd matrix A = tmp added matrix: e(A) : 1 x 2 . eststo male . mat tmp = A[1...,"female:"] . ereturn post . estadd matrix A = tmp added matrix: e(A) : 1 x 2 . eststo female . estout male female, cell((A["1979"](transpose) A["2007"](transpose))) ---------------------------------------------------------------- male female 1979 2007 1979 2007 ---------------------------------------------------------------- mystat 1 2 3 4 ---------------------------------------------------------------- Furthermore, note that -ereturn post- is required even though it does not post anything. ben On Fri, Jan 30, 2009 at 6:03 PM, Howard Lempel <HLempel@brookings.edu> wrote: > Hello all, > > I apologize if this email goes out to the list twice, but I suspect that the first version did not make it through because I forgot to post it in plain text. > > Is there a way to use the -estout- (available from SSC) matrix mode to output super column names above the column names of my matrix? > > I can get the results I want using the -showcoleq(c)- option of -matlist-, but would like to save my matrix. I particularly like the feature that an equation name only shows up once if two columns share it. An example of what I'd like to do using -matlist- follows: > > mat A = (1,2,3,4) > mat coln A = male:1979 male:2007 female:1979 female:2007 > mat rown A = mystat > matlist A, showcoleq(c) > > | male | female > | 1979 2007 | 1979 2007 > -------------+----------------------+---------------------- > mystat | 1 2 | 3 4 > > > I can't get -estout- to do what I want: > -estout matrix(A) using test2- > > male:1979 male:2007 female:1979 female:2007 > mystat 1 2 3 4 > > > I've also had no luck with the -eqlabel- -mlabel- and -mtitle- options in -estout-, presumably because I haven't found a way to tell -estout- to treat columns 1 and 2 as one model and columns 3 and 4 as another. > > If it is relevant, the actual matrix I'm using consists of results from -inequal7-, -pctile-, and -sum-. I'd also be grateful for any suggestions of other ways to create the table I'm after. I suppose one way would be to add a row at the top of my matrix with the years and then to name every other column with a gender, but this would not generalize to a case where my column names are strings. > > Thanks very much for your consideration. > Howie > > Howie Lempel > Research Assistant > The Brookings Institution | Economic Studies > > 1775 Massachusetts Ave NW | Washington DC 20036 > hlempel@brookings.edu | p: (202) 238-3576 > > > > * > * 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/

- Prev by Date:
**RE: st: Simultaneous Equations** - Next by Date:
**st: problems with xtserial 'no observations'** - Previous by thread:
**st: re: simultaneous equations** - Next by thread:
**st: problems with xtserial 'no observations'** - Index(es):

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