This may belabor the obvious, but the following packages Mr. Annis' answer:


pt2 <- function(q, df, log.p=FALSE){ 2*pt(-abs(q), df, log.p=log.p) }

> pt2(2.23, 10)
[1] 0.04984247
> pt2(-2.23, 10)
[1] 0.04984247
> pt(-2.23, 10)
[1] 0.02492124
>
     hope this helps.  spencer graves

Charles Annis, P.E. wrote:

pt(q, ...) returns the area to the left of q.  The area to the left of 2.23
for your situation is 0.975, while the area to the left of -2.23 (which is
on the left side of zero from 2.23) is 0.025.





Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Giovanni Coppola
Sent: Wednesday, December 29, 2004 8:41 PM
To: [email protected]
Subject: [R] t-test pvalue

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


______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



-- Spencer Graves, PhD, Senior Development Engineer O: (408)938-4420; mobile: (408)655-4567

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to