1

In the R function chisq.test() there is the following line:

PVAL <- (1 + sum(ss >= almost.1 * STATISTIC))/(B + 1) with

almost.1 <- 1 - 64 * .Machine$double.eps

This is clearly a computational adjustment to avoid getting round outputs for PVAL.

It doesn't really matter what is calculated, but the idea is that what we really, really want is sum(ss >= STATISTIC)/ B, where ss is the result of a bunch of simulations, STATISTIC is a fixed value to compare to, and B is the number of simulations. We are calculating the percentage of cases in which ss is greater than STATISTIC.

What does adding 1 to both numerator and denominator supposed to accomplish?

and

Why do we need to multiply by 1 - 64 * .Machine$double.eps?

Antoni Parellada
  • 4,253
  • 6
  • 49
  • 114

0 Answers0