Statalist The Stata Listserver


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

RE: st: Mean Test


From   "Newson, Roger B" <r.newson@imperial.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Mean Test
Date   Fri, 20 Jan 2006 13:20:45 -0000

Thanks to Nick for the Box reference (Box, 1953), which I have
downloaded from the JSTOR website at

http://uk.jstor.org/

Other references on the case against heteroskedasticity tests are Moser
and Stevens (1992) and Moser (1989), who use computer simulation methods
not available to George Box (through no fault of his own).

Roger

References

Box GEP. Non-normality and tests for variances. Biometrika 1983; 40:
318-335.

Moser BK. The two sample t-test versus Satterthwaite's approximate
F-test. Communications in statistics - theory and methods 1989; 19:
3963-3975.

Moser BK, Stevens GR. Homogeneity of variances in the two-sample means
test. The American Statistician 1992; 46(1): 19-21.

Roger Newson
Lecturer in Medical Statistics
POSTAL ADDRESS:
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute at Imperial College London
St Mary's Campus
Norfolk Place
London W2 1PG
STREET ADDRESS:
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute at Imperial College London
47 Praed Street
Paddington
London W1 1NR
TELEPHONE: (+44) 020 7594 0939
FAX: (+44) 020 7594 0942
EMAIL: r.newson@imperial.ac.uk
WEBSITE: http://www.kcl-phs.org.uk/rogernewson/
Opinions expressed are those of the author, not of the institution.


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of n j cox
Sent: 19 January 2006 22:07
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Mean Test

I have to wonder about what is being proposed here on
various grounds.

George Box pointed out in Biometrika in 1953 that the
t-test was more robust than testing for variance
equality. His message was that doing a preliminary
test for variances was like putting to sea in
a dinghy to test whether it was safe for a liner
to leave port. So, this goes against statistical
wisdom, setting on one side the detail of how
you decide from -oneway- which variances are
deemed equal.

Additionally, doing every possible pairwise t-test
raises a whole heap of standard issues, such
as how to interpret the P-values. As your
categorical variable is ordered in any case,
other analyses should be more respectful of
the information in your data, say a Jonckheere-Terpstra
test.

Fixing the code to do what you want is not the key issue if the
enterprise appears misconceived.

Nick
n.j.cox@durham.ac.uk

Rijo John

I have around 30 variables for which I need to do a mean test
(ttest for the differences in mean). However, I have three categories.
Lets say I want to find the differences in mean of var1 between Low
Income, middle income and high income. Ideally I need to do a ttest
for the mean of var1 between
1) Low Income Vs Middle Income
2) Low Income Vs High Income
3) Middle Income Vs High Income
   And similarly for var2,...,var30.
One problem is that the mean test procedure is different when the
variances are different. So I first test for the equality of variance
and then apply the formula accordingly. My problem is that I am able
to do this with a small macro when my category is a binary variable.
(Lets say only low income and high income.) How can I do the same in
the case above with three categories? Below is what I do when the
category is a binary.

Local items ``var1, var2,...,var30"
foreach X of local items{
 	oneway var`X' BinaryVar [aw=weight], tabulate
 	}
I then identify the variables with equal variances and not. (I'm sure
there are more efficient ways of doing it. But my programming skills
are a big zero)

local equalsig "varX, vary,..., varZ"
local unequalsig "VarA, varB,...,varC"

foreach X of local equalsig{
 	display "Summary Statistics for for bs`X'"
 	summ bs`X' [aw=hmul] if BinaryVar==0
 	qui ret list
 	local mean1 = `r(mean)'
            local sd1   = `r(sd)'
 	local obs1  = `r(N)'
 	summ bs`X' [aw=hmul] if BinaryVar==1
 	qui ret list
 	local mean2 = `r(mean)'
            local sd2   = `r(sd)'
 	local obs2  = `r(N)'
            display "Two sample T-Test for euqality of means (equal
variance): var`X'"
 	ttesti `obs1' `mean1' `sd1' `obs2' `mean2' `sd2', level(95)
 	}
macro drop obs1 mean1 sd1 obs2 mean2 sd2
foreach X of local unequalsig{
 	display "Summary Statistics for var`X'"
 	summ bs`X' [aw=hmul] if BinaryVar==0
 	qui ret list
 	local mean1 = `r(mean)'
            local sd1   = `r(sd)'
 	local obs1  = `r(N)'
 	summ bs`X' [aw=hmul] if BinaryVar==1
 	qui ret list
 	local mean2 = `r(mean)'
            local sd2   = `r(sd)'
 	local obs2  = `r(N)'
            display "Two sample T-Test for euqality of means (unequal
variance): var`X'"
            ttesti `obs1' `mean1' `sd1' `obs2' `mean2' `sd2', unequal
welch level(95)
 	}

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

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

*
*   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–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index