![Statalist](/includes/images/head_statalist.jpg) |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: a question on t-test
At 04:38 PM 6/20/2008, Lili Yan wrote:
Hi Richard,
Thank you very much for your prompt response! I did not use -ttest-
for several reasons:
First, I actually have a weight variale in my data and -ttest- does
not allow weights.
Second, I need compare means of many variables, so I want to quietly
run means calculation and comparison, then generate a table with -mat-
commands. In that table, I want to see p-value. So I have to calculate
it as Stata does not save it.
OK, first off, using lincom seems to be the equivalent of running a
t-test with the unequal variances option. Run this code:
sysuse auto
mean mpg, over(foreign)
lincom [mpg]Domestic-[mpg]Foreign
ttest mpg, by(foreign)
ttest mpg, by(foreign) unequal
Second, what about just running
reg mpg foreign
A couple of people have suggested oneway or anova. Those might do
the trick, but it depends on your weights, i.e. reg allows pweights
but anova and oneway do not. Also, when you say "I need compare
means of many variables" to me that sounds like you have multiple
dependent variables rather than multiple groups. Maybe you want
manova or mvreg or something like that.
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME: (574)289-5227
EMAIL: [email protected]
WWW: http://www.nd.edu/~rwilliam
*
* 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/