# [R] t.test

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Fri Jul 6 11:25:09 CEST 2007

```matthew5555 wrote:
> Hi, how can I solve a problem without the function t.test???
>
> for example:
> x<-(1,3,5,7)
> y<-(2,4,6)
> t.test(x,y,alternative="less",paired=FALSE,var.equal=TRUE,conf.level=0.95)
>
>
>
Homework?

Hints: Take out your statistics textbook and look up the formulas for
the two-sample t.
You'll probably (there can be some variation depending on the book) find
that you need to compute

- difference of means
- sd for each group
- pooled sd
- s.e. of differences of means

all of which you can do easily in R, once you have the formulas. Then
calculate the t statistic and the corresponding p value, either using a
table or R's function for the t distibution.

--
O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907

```