[R] getting the exact p value
Joshua Wiley
jwiley.psych at gmail.com
Mon Dec 6 20:45:47 CET 2010
Hi,
It depends on the function used to calculate it---each has their own
way of extracting particular values. Here's an example for t.test:
x <- rnorm(10, 100, .1); y <- x - 100
t.test(x, y)$p.value
You could find this yourself by looking at the documentation for t.test()
?t.test
The heading "Value" shows what the function returns (though not
necessarily all printed). Typically, you can access any of those by
$theirname. In this case you see p.value, so you can get the p-value
by: t.test()$p.value. Equivalently (and more useful for reference)
## save the results of t.test()
txy <- t.test(x, y)
txy$p.value
HTH,
Josh
On Mon, Dec 6, 2010 at 11:03 AM, kayj <kjaja27 at yahoo.com> wrote:
>
> I was wondering if there is a way to get an exact p-value at times where R
> gives me just a range . for example
> t.test(x,y)
> p-value < 2.2e-16
>
> thanks,
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/getting-the-exact-p-value-tp3075107p3075107.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.
>
--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/
More information about the R-help
mailing list