Dr. Weeks is a Professor of Human Genetics and Biostatistics at the University of Pittsburgh. His research focuses on statistical human genetics in the area of mapping susceptibility loci involved in complex human diseases. The content on this blog is for informational purposes only - use at your own risk!
Tuesday, October 29, 2013
Computers are useful?!
"A computer makes it possible to do, in half an hour, tasks which were completely unnecessary to do before" ~ Dave Barry.
Wednesday, August 14, 2013
Zero p-values in R
For the top hits from an R program, I was getting all zero p-values, which are not that useful for ranking or plotting.
Turns out that the R program was calculating the p-value in this manner:
1 - pchisq(71.12830,1)
But, according to the discussion here, in R
".Machine$double.eps is the smallest number such that 1+x can be distinguished from 1"
On my machine, we have that:
> .Machine$double.eps
[1] 2.220446e-16
So that is why this truncates to zero:
> 1 - pchisq(71.12830,1)
[1] 0
However, we can get a non-zero p-value if instead we compute it this way:
> pchisq(71.12830,1,lower.tail=FALSE)
[1] 3.347341e-17
Turns out that the R program was calculating the p-value in this manner:
1 - pchisq(71.12830,1)
But, according to the discussion here, in R
".Machine$double.eps is the smallest number such that 1+x can be distinguished from 1"
On my machine, we have that:
> .Machine$double.eps
[1] 2.220446e-16
So that is why this truncates to zero:
> 1 - pchisq(71.12830,1)
[1] 0
However, we can get a non-zero p-value if instead we compute it this way:
> pchisq(71.12830,1,lower.tail=FALSE)
[1] 3.347341e-17
Subscribe to:
Posts (Atom)