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 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]

st: 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: tables with makematrix and estout
Date   Tue, 6 Dec 2011 20:57:52 +0000

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

 This program uses two user written programs: estout (by=A0Jann, 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) =A0statistics(mean
sd) columns(statistics)
estadd matrix chi_p=3D chi_p

esttab , cells("mean =A0chi_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