[R] adjusted t-test with unequal variance

Greg Snow Greg.Snow at imail.org
Thu Oct 9 15:02:17 CEST 2008


Try the gls function in the nlme package.  It allows you to model the variance as well as the mean.

-----Original Message-----
From: "Bunny, lautloscrew.com" <bunny at lautloscrew.com>
To: "r-help at r-project.org" <r-help at r-project.org>
Sent: 10/9/08 3:40 AM
Subject: [R] adjusted t-test with unequal variance


Hi all,


right now i am simply comparing means. obviously this can be done by
the simple t.test respectively the welch test, if var.equal is set to
FALSE.

just like this

t.test( Y ~ group)
t.test( Y ~ group, var.equal = FALSE)

now that i need to compare weighted means i am using the lm function
as an adjusted t-test:

like

lmtest <- ( Y ~ group )
anova(lmtest)

lmtest$fitted.values[data$group==1]
lmtest$fitted.values[data$group==0]


basically this delivers just the same means and p.value like the test
with equal variance.
and here's where my problem is...:
checking bartletts test and the var.test i found that the assumption
of equal variance might be at least venturesome for some of my
variables...

Can I replace the lmtest by something else, assuming variances are not
equal ? I read about a quasi option of glm on the mailing lists...

Thx in advance for any suggestions

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list