Reputation: 101
does anyone know why there are two different p values produced using the fisher.test() function in R?
> testMat<-matrix(c(190,9641,177,26067),ncol=2)
> fisher.test(testMat)
Fisher's Exact Test for Count Data
data: testMat
p-value < 2.2e-16
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
2.349071 3.587034
sample estimates:
odds ratio
2.902246
> fisher.test(testMat)$p.value
[1] 1.832771e-23
> fisher.test(testMat)[1]
$p.value
[1] 1.832771e-23
From other exact tests (output not included), it appears the default output from fisher.test() has a lower threshold of 2.2e-16, even if the true p-value is retained. I'm curious where this is programmed, as I didn't see it in the output code of fisher.test
or documentation for htest
.
Upvotes: 0
Views: 878
Reputation: 206167
This does not affect fisher.test
exclusively. This is just how R formats p-values. The function that does the formatting is format.pval
. Observe
x<-1.832771e-23
format.pval(x)
# [1] "< 2.22e-16"
When the p-value gets less than the numerical tolerance of your machine, R basically just says it's a "really small number". See ?format.pval
for the details.
Upvotes: 3