[R] Independant-samples t-test
Mark Myatt
mark at myatt.demon.co.uk
Mon Apr 2 11:27:50 CEST 2001
Dr Stuart Leask <stuart.leask at nottingham.ac.uk> writes:
>I can't find a 'group' option in t.test (library ctest).
>
>(eg. X = normally-distributed rating scale
>Y = sex
>I'd like to compare the means by sex, but can't do t.test(X,group=Y) or
>whatever).
Index the vector by group:
t.test(x[sex == 1], x[sex == 2])
should do the trick. You could try:
summary(aov(sex~group))
which is equivalent but assumes equal variances.
Mark
--
Mark Myatt
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list