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

st: re: table for differences in means test

From   Kit Baum <>
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
An Introduction to Modern Econometrics Using Stata:

* For searches and help try:

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