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]
st: RE: tables with makematrix and estout
From
"Elizabeth Gifford, Ph.D." <[email protected]>
To
"[email protected]" <[email protected]>
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/