[R] A very small p-value

Peter Dalgaard pd@|gd @end|ng |rom gm@||@com
Tue Oct 28 14:42:59 CET 2025


Um,

> pnorm(-405, log=TRUE)/log(10)
[1] -35620.58
> qnorm(2.2e-226)
[1] -32.10006

and I don’t think that our *norm functions are THAT bad in the tails?

-pd


> On 28 Oct 2025, at 14.26, Michael Dewey <lists using dewey.myzen.co.uk> wrote:
> 
> 
> 
> On 28/10/2025 10:13, Peter Dalgaard wrote:
>> I suspect this is more like a relic from times when people would do (say) 1 - pchisq(x,f) instead of pchisq(x, f, lower=FALSE) and intended to avoid the embarrassment of printing 0 for things that weren’t actually impossible.
>> People have been known to have unexpected uses for the tiny probabilities (one case came from theoretical physics - I think it got recorded as a fortune() entry) but rarely as low as 10^-16 in actual significance testing. Things like whole genome scans may suggest some hefty Bonferroni multipliers, but the numer of tests are not (yet?) in the trillions (US).
> 
> A paper in Nature https://www.nature.com/articles/nature14151 by stensola and colleagues (sorry there does not seem to be a DOI but it is also vol 518, pages 207–212 (2015)) reports a p-value of Z = 405, P = 2.2 * 10^{−226} which is believed to be the current record. To give credit where it is due this was posted in a comment by user amoeba on CrossValidated.
> 
> Michael
> 
>> - pd
>>> On 26 Oct 2025, at 23.34, Ben Bolker <bbolker using gmail.com> wrote:
>>> 
>>>  One possible source of confusion is that the `print.Coefmat` function uses .Machine$double.eps as its threshold for printing "< [minimum value]" rather than the precise computed p-value (presumably on the grounds that a number smaller than this is likely to be unrealistic as an accurate statement of the unlikeliness of an outcome in the real world).
>>> 
>>> On 10/26/25 10:41, Richard O'Keefe wrote:
>>>> No, 0 and 5-19 are not "equalled".  THey are quite distinct.
>>>> As for pt() returning something smaller than double.eps, why wouldn't it?
>>>> If I calculate 10^-30, I get 1e-30, which is much smaller than  double.eps,
>>>> but is still correct.  It would be a serious error to return 0 for 10^-30.
>>>> Welcome to the wonderful world of floating-point arithmetic.
>>>> This really has nothing to do with R.
>>>> On Sun, 26 Oct 2025 at 09:38, Christophe Dutang <dutangc using gmail.com> wrote:
>>>>> 
>>>>> Thanks for your answers.
>>>>> 
>>>>> I was not aware of the R function expm1().
>>>>> 
>>>>> I’m completely aware that 1 == 1 - 5e-19. But I was wondering why pt() returns something smaller than double.eps.
>>>>> 
>>>>> For students who will use this exercise, it is disturbing to find 0 or 5e-19 : yet it will be a good exercise to find that these quantities are equalled.
>>>>> 
>>>>> Regards, Christophe
>>>>> 
>>>>>> Le 25 oct. 2025 à 12:14, Ivan Krylov <ikrylov using disroot.org> a écrit :
>>>>>> 
>>>>>> В Sat, 25 Oct 2025 11:45:42 +0200
>>>>>> Christophe Dutang <dutangc using gmail.com> пишет:
>>>>>> 
>>>>>>> Indeed, the p-value is lower than the epsilon machine
>>>>>>> 
>>>>>>>> pt(t_score, df = n-2, lower=FALSE) < .Machine$double.eps
>>>>>>> [1] TRUE
>>>>>> 
>>>>>> Which means that for lower=TRUE, there will not be enough digits in R's
>>>>>> numeric() type to represent the 5*10^-19 subtracted from 1 and
>>>>>> approximately 16 zeroes.
>>>>>> 
>>>>>> Instead, you can verify your answer by asking for the logarithm of the
>>>>>> number that is too close to 1, thus retaining more significant digits:
>>>>>> 
>>>>>> print(
>>>>>> -expm1(pt(t_score, df = n-2, lower=TRUE, log.p = TRUE)),
>>>>>> digits=16
>>>>>> )
>>>>>> # [1] 2.539746620181249e-19
>>>>>> print(pt(t_score, df = n-2, lower=FALSE), digits=16)
>>>>>> # [1] 2.539746620181248e-19
>>>>>> 
>>>>>> expm1(.) computes exp(.)-1 while retaining precision for numbers that
>>>>>> are too close to 0, for which exp() would otherwise return 1.
>>>>>> 
>>>>>> See the links in
>>>>>> https://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f
>>>>>> for a more detailed explanation.
>>>>>> 
>>>>>> --
>>>>>> Best regards,
>>>>>> Ivan
>>>>>> (flipping the "days since referring to R FAQ 7.31" sign back to 0)
>>>>> 
>>>>> ______________________________________________
>>>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>> ______________________________________________
>>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>> 
>>> -- 
>>> Dr. Benjamin Bolker
>>> Professor, Mathematics & Statistics and Biology, McMaster University
>>> Associate chair (graduate), Mathematics & Statistics
>>> Director, School of Computational Science and Engineering
>>> * E-mail is sent at my convenience; I don't expect replies outside of working hours.
>>> 
>>> ______________________________________________
>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>> ______________________________________________
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> -- 
> Michael Dewey


-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com



More information about the R-help mailing list