Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: specifying difference in Ho of ttest


From   Richard Williams <[email protected]>
To   [email protected], <[email protected]>
Subject   Re: st: Re: specifying difference in Ho of ttest
Date   Wed, 14 Jan 2004 21:11:41 -0500

At 06:15 PM 1/14/2004 -0600, Scott Merryman wrote:
Isn't this just calculating the difference and then using -ttest diff = #-

Example:

. sysuse auto
(1978 Automobile Data)

. gen diff = disp - length

. ttest diff = 10
That should work, and is more straightforward than what I tossed out before. A matched pairs problem can be converted into a single sample t-test problem in this way.

One thing that occurs to me: Scott and I both interpreted this as a matched pairs problem. But, if the original author meant "diff" to stand for the difference between 2 group means (i.e. an independent samples t-test) rather than the difference between the means of two variables (matched pairs) then neither Scott's nor my approach is right. So, if you hypothesized that group 1's mean was 10 points higher than group 2's, you'd do something like

gen score2 = score
replace score2 = score2-10 if group==1
ttest score2, by(group)

-------------------------------------------
Richard Williams, Associate Professor
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc

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