What's the lowest number R will present before rounding to 0?

断了今生、忘了曾经 提交于 2019-12-02 12:01:33

.Machine$double.xmin gives you the smallest non-zero normalized floating-point number. On most systems that's 2.225074e-308. However, I don't believe this is a sensible limit.

Instead I suggest that in Matching::ks.boot you change the line

ks.boot.pval <- bbcount/nboots to

ks.boot.pval <- log(bbcount)-log(nboots) and work on the log-scale.

Edit:

You can use trace to modify the function.

Step 1: Look at the function body, to find out where to add additional code.

as.list(body(ks.boot))

You'll see that element 17 is ks.boot.pval <- bbcount/nboots, so we need to add the modified code directly after that.

Step 2: trace the function.

trace (ks.boot, quote(ks.boot.pval <- log(bbcount)-log(nboots)), at=18)

Step 3: Now you can use ks.boot and it will return the logarithm of the bootstrap p-value as ks.boot.pvalue. Note that you cannot use summary.ks.boot since it calls format.pval, which will not show you negative values.

Step 4: Use untrace(ks.boot) to remove the modifications.

I don't know whether ks.boot has methods in the packages Rmpfr or gmp but if it does, or you feel like rolling your own code, you can work with arbitrary precision and arbitrary size numbers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!