# Re: st: a question on t-test

 From Martin Weiss To statalist@hsphsun2.harvard.edu Subject Re: st: a question on t-test Date Fri, 20 Jun 2008 23:42:58 +0200

You might want to look into -anova-, with -oneway- as a simpler entry point, if you have several comparisons to conduct..

Zitat von Lili Yan <lyan16@gmail.com>:

```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.

To me, the -lincom- seems to do what I want, but I want to confirm
this with people better in statistics and more familiar with Stata
than me. Please let me know if what I did is correct. Thanks a lot!

Best,
Lili

On Fri, Jun 20, 2008 at 4:24 PM, Richard Williams
<Richard.A.Williams.5@nd.edu> wrote:
```
```I'm probably missing something, but wouldn't it be a lot more
straightforward just to use the ttest command, e.g.

ttest mpg, by(foreign)

At 04:57 PM 6/20/2008, Lili Yan wrote:
```
```Hi there,

I need calculate the mean of two groups (say, native cars and foreign
cars) and do a t-test. However, I am not very sure if -lincom- is the
correct command after -mean-. Could anyone please let me know if the
following commands are right?

mean mpg, over(foreign)
lincom [`var']0-[`var']1
di 2*ttail(r(df), abs(r(estimate)/r(se)))

Best,
Lili
*
*   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/
```
```-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
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/

```
```*
*   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/

```
```

*
*   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/
```