[R] t-test pvalue

Giovanni Coppola gcoppola at ucla.edu
Thu Dec 30 02:40:54 CET 2004


Hi all,
I have some t-test values, and I am trying to obtain the associated p-values.
Is 'pt' the right command? I wonder why 1) it returns different values for 
x and -x, and 2) how to obtain a 2-sided p-value.

example [R version 2.0.1, WinXP]:
#if t=2.23 (df=10), the expected p-value is 0.05 for 2-sided and 0.025 for 
1-sided t-test

pt (2.23,10)
[1] 0.9750788

pt (-2.23,10) #or pt (2.23,10,lower.tail=FALSE)
[1] 0.02492124 #as expected

The opposite happens starting from negative t-test values.

Should I convert in negative values my t-test values, and leave 
lower.tail=TRUE?
Thanks and happy new year
Giovanni




More information about the R-help mailing list