Sometimes the p.value returned by t.test() is the same that I calculate using 
pt() and sometimes it's not. I don't understand the difference. I'm sure there 
is a simple explanation but I haven't been able to find it, even after looking 
at the code for t.test.default. I apologize if this is a basic and obvious 
question. For example:

> data(sleep)
> t.test(extra~group,data=sleep,var.equal=T)

# the p.value returned is 0.07939

> 2*pt(-1.8608,18)   # using the t.statistic and the df returned above
[1] 0.0791887

These p.values are the same. However, they are different when I use a different 
dataset:

> data(beavers)
> b1 <- beaver1$temp
> b2 <- beaver2$temp
> t.test(b1,b2,var.equal=T)

# the p.value returned is 2.2e-16

> 2*pt(-15.9366,212)   # using the t.statistic and the df returned above
[1] 4.10686e-38


Jonathan B. Thayn, Ph.D.
Illinois State University
Department of Geography and Geology
200A Felmley Hall
Normal, Illinois 61790

(309) 438-8112
jth...@ilstu.edu
my.ilstu.edu/~jthayn




        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to