Statalist


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

Re: st: two-sample vs. two-mean


From   Richard Goldstein <[email protected]>
To   [email protected]
Subject   Re: st: two-sample vs. two-mean
Date   Tue, 08 Apr 2008 09:22:22 -0400

ttest mpg1=mpg2 gives a paired t-test

after stacking, ttest mpg, by(group) gives an unpaired t-test

if you replace the first t-test by

ttest mpg1=mpg2, unp

you will match the result after stack

Rich

Martin Weiss wrote:
Dear Statalisters,


Try this in Stata:

**********
webuse fuel, clear
qui{
*two-sample mean comparison
noi ttest mpg1==mpg2
local pl1=r(p_l) local pu1=r(p_u)
local p1=r(p)

*two-group mean comparison
stack mpg1 mpg2, into(mpg) clear
rename _s group
noi ttest mpg, by(group)
local pl2=r(p_l) local pu2=r(p_u)
local p2=r(p)

*Results
noi di _newline
noi di in red "Results:" _newline
noi di in red "Test against H1: <" _column(23) round(`pl1', .001) " versus
" round(`pl2', .001) _newline noi di in red "Test against H1: >" _column(23) round(`pu1', .001) " versus
" round(`pu2', .001) _newline
noi di in red "Test against H1: !=" _column(23) round(`p1', .001) " versus "
round(`p2', .001) _newline
}
**********

Then let me know how I can easily explain the difference between a
"two-sample mean" and a "two-group mean" comparison test.

Warm regards,
Martin Weiss
_________________________________________________________________

Diplom-Kaufmann Martin Weiss
Mohlstrasse 36
Room 415
72074 Tuebingen
Germany

Fon: 0049-7071-2978184

Home: http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1130

Publications: http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1131

SSRN: http://papers.ssrn.com/sol3/cf_dev/AbsByAuth.cfm?per_id=669945



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



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