Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: re: table for differences in means test


From   Kit Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: re: table for differences in means test
Date   Sat, 21 Jul 2007 21:12:43 -0400

Hugh writes

I tried using this code

qui {

noi di "Variable`=char(9)'N1`=char(9)'Mean1`=char(9)'N2`=char (9)'Mean2`=char(9)'p-value"

foreach var of varlist q52-q61 {
cap ttest `var', by (q2q6)

noi di as text "`var'`=char(9)'" as result %8.0f `r(count)'
"`=char(9)'" %8.2f `r(mu_1)' "`=char(9)'" %8.2f `r(p)'
}
}


If you do

sysuse auto
ttest price, by(foreign)
return list

you see that r(N_1) and r(N_2) contain the counts in the two categories. There is no r(count).
You probably want to include both r(mu_1) and r(mu_2) in your display statement if you want to
see the means of each category.



Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* 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   |   What's new   |   Site index