[R] exact values for p-values

Stephen D. Weigand weigand.stephen at charter.net
Wed Jul 13 06:11:59 CEST 2005


On Jul 11, 2005, at 11:47 AM, S.O. Nyangoma wrote:

> Hi there,
> If I do an lm, I get p-vlues as
>
> p-value: < 2.2e-16
>
> Suppose am interested in exact value such as
>
> p-value = 1.6e-16 (note = and not <)
>
> How do I go about it?
>
> stephen
>

I think you're seeing a very small p-value after it has been formatted 
by format.pval.
Consider:

options(digits = 6)
format.pval(0)
# [1] "< 2.2e-16"

format.pval(0, eps = 1e-20)
# [1] "< 1e-20"

you could access the p-values you're interested following this example:

x <- 1:100
y <- x + rnorm(100, 0, 1)
f <- lm(y ~ x)
ff <- summary(f)
print(ff)
ff$coefficients
Pvals <- ff$coefficients[, 4]
print(Pvals, digits = 20)

Hope this helps,

Stephen




More information about the R-help mailing list