hypeR
hypeR copied to clipboard
.kstest needs to match ks.test (modulo the sign)
I realized that .kstest
, as it is now implemented, does not match ks.test
's behavior when alternative != "two.sided"
. In particular, the score in ks.test
is defined as follows:
STATISTIC <- switch(alternative, two.sided = max(abs(z)),
greater = max(z), less = -min(z))
Thus, in .kstest
, score
should be computed as follows:
score <- if (absolute) max(z)-min(z) else switch(alternative,
two.sided = z[which.max(abs(z))],
greater = max(z),
less = min(z))
Also, the command
results <- suppressWarnings(ks.test(1:n.x, y, alternative="less"))
should be replaced by
results <- suppressWarnings(ks.test(y, 1:n.x, alternative="greater"))