Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: RE: tables with makematrix and estout


From   "Elizabeth Gifford, Ph.D." <beth.gifford@duke.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: tables with makematrix and estout
Date   Tue, 6 Dec 2011 21:07:33 +0000

I'm not sure from where the=A0's came but hopefully this will post correctly.  I apologize for the inconvenience.


Hi there
I was wondering if anyone know a tip for adding the chi-sq or ttests
to a table of means by group. I'm really close but currently have the
chi-sq and p-values appearing in every row after the mean of a given
group. (see below).

 This program uses two user written programs: estout (by Jann, Ben) and makematrix (by Nick Cox)

ssc install estout, replace

 ssc install makematrix


********************************Program

sysuse auto,clear
makematrix chi_p, from(r(chi2) r(p)) lhs( price mpg trunk weight) : tab foreign, chi2

estpost tabstat price mpg trunk weight, by(foreign) =statistics(mean sd) columns(statistics)
estadd matrix chi_p=3D chi_p

esttab , cells("mean =chi_p[1] (transpose) chi_p[2] (transpose)") unstack label compress
*************************************
*I have a work around that involves taking the e(mean) matrix after
the tabstat command but I was hoping for a simpler solution.












*
*   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/


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